Add missing linter metadata for stdlib.

Fixes #483.
This commit is contained in:
Stanisław Barzowski 2020-12-20 21:17:29 +01:00
parent 6140a2f75a
commit 31d71aaccd
5 changed files with 31 additions and 0 deletions

View File

@ -31,11 +31,21 @@ func prepareStdlib(g *typeGraph) {
"length": g.newSimpleFuncType(numberType, "x"),
"objectHas": g.newSimpleFuncType(boolType, "o", "f"),
"objectFields": g.newSimpleFuncType(arrayOfString, "o"),
"objectValues": g.newSimpleFuncType(anyArrayType, "o"),
"objectHasAll": g.newSimpleFuncType(boolType, "o", "f"),
"objectFieldsAll": g.newSimpleFuncType(arrayOfString, "o"),
"objectValuesAll": g.newSimpleFuncType(anyArrayType, "o"),
"prune": g.newSimpleFuncType(anyObjectType, "a"),
"mapWithKey": g.newSimpleFuncType(anyObjectType, "func", "obj"),
// isSomething
"isArray": g.newSimpleFuncType(boolType, "v"),
"isBoolean": g.newSimpleFuncType(boolType, "v"),
"isFunction": g.newSimpleFuncType(boolType, "v"),
"isNumber": g.newSimpleFuncType(boolType, "v"),
"isObject": g.newSimpleFuncType(boolType, "v"),
"isString": g.newSimpleFuncType(boolType, "v"),
// Mathematical utilities
"abs": g.newSimpleFuncType(numberType, "n"),
"sign": g.newSimpleFuncType(numberType, "n"),

View File

@ -0,0 +1 @@
!std.setMember([1, 2, 3], 1)

View File

View File

@ -78,6 +78,12 @@
4
],
"format": "test blah 42",
"isArray": true,
"isBoolean": true,
"isFunction": true,
"isNumber": true,
"isObject": true,
"isString": true,
"join": "a,b,c",
"length": 0,
"lines": "a\nb\nc\n",
@ -115,8 +121,11 @@
"mergePatch": { },
"min": 2,
"objectFields": [ ],
"objectFieldsAll": [ ],
"objectHas": false,
"objectHasAll": false,
"objectValues": [ ],
"objectValuesAll": [ ],
"parseHex": 3735928559,
"parseInt": 42,
"parseJson": {

View File

@ -15,10 +15,21 @@
length: std.length(x=[]),
objectHas: std.objectHas(o={}, f="fieldname"),
objectFields: std.objectFields(o={}),
objectValues: std.objectValues(o={}),
objectHasAll: std.objectHasAll(o={}, f="fieldname"),
objectFieldsAll: std.objectFieldsAll(o={}),
objectValuesAll: std.objectValuesAll(o={}),
prune: std.prune(a={x: null, y: [null, "42"]}),
mapWithKey: std.mapWithKey(func=function(key, value) 42, obj={a: 17}),
// isSomething
isArray: std.isArray(v=[]),
isBoolean: std.isBoolean(v=true),
isFunction: std.isFunction(v=function() 42),
isNumber: std.isNumber(v=42),
isObject: std.isObject(v={}),
isString: std.isString(v=""),
// Mathematical utilities
abs: std.abs(n=-42),
sign: std.sign(n=17),