mirror of
https://github.com/google/go-jsonnet.git
synced 2025-09-28 17:01:02 +02:00
fix: add std.objectKeysValues to jsonnet-lint (#706)
This commit is contained in:
parent
7b9f5fd4b4
commit
fed90cd9cd
@ -25,18 +25,20 @@ func prepareStdlib(g *typeGraph) {
|
|||||||
"extVar": g.newSimpleFuncType(anyType, "x"),
|
"extVar": g.newSimpleFuncType(anyType, "x"),
|
||||||
|
|
||||||
// Types and reflection
|
// Types and reflection
|
||||||
"thisFile": stringType,
|
"thisFile": stringType,
|
||||||
"type": g.newSimpleFuncType(stringType, "x"),
|
"type": g.newSimpleFuncType(stringType, "x"),
|
||||||
"length": g.newSimpleFuncType(numberType, "x"),
|
"length": g.newSimpleFuncType(numberType, "x"),
|
||||||
"objectHas": g.newSimpleFuncType(boolType, "o", "f"),
|
"objectHas": g.newSimpleFuncType(boolType, "o", "f"),
|
||||||
"objectFields": g.newSimpleFuncType(arrayOfString, "o"),
|
"objectFields": g.newSimpleFuncType(arrayOfString, "o"),
|
||||||
"objectValues": g.newSimpleFuncType(anyArrayType, "o"),
|
"objectValues": g.newSimpleFuncType(anyArrayType, "o"),
|
||||||
"objectHasAll": g.newSimpleFuncType(boolType, "o", "f"),
|
"objectKeysValues": g.newSimpleFuncType(anyArrayType, "o"),
|
||||||
"objectFieldsAll": g.newSimpleFuncType(arrayOfString, "o"),
|
"objectHasAll": g.newSimpleFuncType(boolType, "o", "f"),
|
||||||
"objectValuesAll": g.newSimpleFuncType(anyArrayType, "o"),
|
"objectFieldsAll": g.newSimpleFuncType(arrayOfString, "o"),
|
||||||
"prune": g.newSimpleFuncType(anyObjectType, "a"),
|
"objectValuesAll": g.newSimpleFuncType(anyArrayType, "o"),
|
||||||
"mapWithKey": g.newSimpleFuncType(anyObjectType, "func", "obj"),
|
"objectKeysValuesAll": g.newSimpleFuncType(anyArrayType, "o"),
|
||||||
"get": g.newFuncType(anyType, []ast.Parameter{required("o"), required("f"), optional("default"), optional("inc_hidden")}),
|
"prune": g.newSimpleFuncType(anyObjectType, "a"),
|
||||||
|
"mapWithKey": g.newSimpleFuncType(anyObjectType, "func", "obj"),
|
||||||
|
"get": g.newFuncType(anyType, []ast.Parameter{required("o"), required("f"), optional("default"), optional("inc_hidden")}),
|
||||||
|
|
||||||
// isSomething
|
// isSomething
|
||||||
"isArray": g.newSimpleFuncType(boolType, "v"),
|
"isArray": g.newSimpleFuncType(boolType, "v"),
|
||||||
|
2
testdata/stdlib_smoke_test.golden
vendored
2
testdata/stdlib_smoke_test.golden
vendored
@ -140,6 +140,8 @@
|
|||||||
"objectFieldsAll": [ ],
|
"objectFieldsAll": [ ],
|
||||||
"objectHas": false,
|
"objectHas": false,
|
||||||
"objectHasAll": false,
|
"objectHasAll": false,
|
||||||
|
"objectKeysValues": [ ],
|
||||||
|
"objectKeysValuesAll": [ ],
|
||||||
"objectValues": [ ],
|
"objectValues": [ ],
|
||||||
"objectValuesAll": [ ],
|
"objectValuesAll": [ ],
|
||||||
"parseHex": 3735928559,
|
"parseHex": 3735928559,
|
||||||
|
2
testdata/stdlib_smoke_test.jsonnet
vendored
2
testdata/stdlib_smoke_test.jsonnet
vendored
@ -16,9 +16,11 @@
|
|||||||
objectHas: std.objectHas(o={}, f="fieldname"),
|
objectHas: std.objectHas(o={}, f="fieldname"),
|
||||||
objectFields: std.objectFields(o={}),
|
objectFields: std.objectFields(o={}),
|
||||||
objectValues: std.objectValues(o={}),
|
objectValues: std.objectValues(o={}),
|
||||||
|
objectKeysValues: std.objectKeysValues(o={}),
|
||||||
objectHasAll: std.objectHasAll(o={}, f="fieldname"),
|
objectHasAll: std.objectHasAll(o={}, f="fieldname"),
|
||||||
objectFieldsAll: std.objectFieldsAll(o={}),
|
objectFieldsAll: std.objectFieldsAll(o={}),
|
||||||
objectValuesAll: std.objectValuesAll(o={}),
|
objectValuesAll: std.objectValuesAll(o={}),
|
||||||
|
objectKeysValuesAll: std.objectKeysValuesAll(o={}),
|
||||||
prune: std.prune(a={x: null, y: [null, "42"]}),
|
prune: std.prune(a={x: null, y: [null, "42"]}),
|
||||||
mapWithKey: std.mapWithKey(func=function(key, value) 42, obj={a: 17}),
|
mapWithKey: std.mapWithKey(func=function(key, value) 42, obj={a: 17}),
|
||||||
get: [
|
get: [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user