1local assertNames(fun, params) = assert test.paramNames(std[fun]) == params: "Wrong params for std.%s, expected %s, got %s" % [fun, params, test.paramNames(std[fun])]; true;23local names = {4 id: ['x'],5 isString: ['v'],6 isNumber: ['v'],7 isBoolean: ['v'],8 isObject: ['v'],9 isArray: ['v'],10 isFunction: ['v'],11 isNull: ['v'],12 toString: ['a'],13 substr: ['str', 'from', 'len'],14 startsWith: ['a', 'b'],15 endsWith: ['a', 'b'],16 lstripChars: ['str', 'chars'],17 rstripChars: ['str', 'chars'],18 stripChars: ['str', 'chars'],19 trim: ['str'],20 stringChars: ['str'],21 parseInt: ['str'],22 parseOctal: ['str'],23 parseHex: ['str'],24 split: ['str', 'c'],25 splitLimit: ['str', 'c', 'maxsplits'],26 splitLimitR: ['str', 'c', 'maxsplits'],27 strReplace: ['str', 'from', 'to'],28 asciiUpper: ['str'],29 asciiLower: ['str'],30 range: ['from', 'to'],31 repeat: ['what', 'count'],32 slice: ['indexable', 'index', 'end', 'step'],33 member: ['arr', 'x'],34 count: ['arr', 'x'],35 mod: ['a', 'b'],36 map: ['func', 'arr'],37 mapWithIndex: ['func', 'arr'],38 mapWithKey: ['func', 'obj'],39 flatMap: ['func', 'arr'],40 join: ['sep', 'arr'],41 lines: ['arr'],42 deepJoin: ['arr'],43 format: ['str', 'vals'],44 foldr: ['func', 'arr', 'init'],45 foldl: ['func', 'arr', 'init'],46 filterMap: ['filter_func', 'map_func', 'arr'],47 assertEqual: ['a', 'b'],48 abs: ['n'],49 sign: ['n'],50 max: ['a', 'b'],51 min: ['a', 'b'],52 clamp: ['x', 'minVal', 'maxVal'],53 flattenArrays: ['arrs'],54 flattenDeepArray: ['value'],55 manifestIni: ['ini'],56 manifestToml: ['value'],57 manifestTomlEx: ['value', 'indent'],58 escapeStringJson: ['str_'],59 escapeStringPython: ['str'],60 escapeStringBash: ['str_'],61 escapeStringDollars: ['str_'],62 escapeStringXML: ['str_'],63 manifestJson: ['value'],64 manifestJsonMinified: ['value'],65 manifestJsonEx: ['value', 'indent', 'newline', 'key_val_sep'],66 manifestYamlDoc: ['value', 'indent_array_in_object', 'quote_keys'],67 manifestYamlStream: ['value', 'indent_array_in_object', 'c_document_end', 'quote_keys'],68 manifestPython: ['v'],69 manifestPythonVars: ['conf'],70 manifestXmlJsonml: ['value'],71 base64: ['input'],72 base64DecodeBytes: ['str'],73 base64Decode: ['str'],74 reverse: ['arr'],75 sort: ['arr', 'keyF'],76 uniq: ['arr', 'keyF'],77 set: ['arr', 'keyF'],78 setMember: ['x', 'arr', 'keyF'],79 setUnion: ['a', 'b', 'keyF'],80 setInter: ['a', 'b', 'keyF'],81 setDiff: ['a', 'b', 'keyF'],82 mergePatch: ['target', 'patch'],83 get: ['o', 'f', 'default', 'inc_hidden'],84 objectFields: ['o'],85 objectFieldsAll: ['o'],86 objectHas: ['o', 'f'],87 objectHasAll: ['o', 'f'],88 objectValues: ['o'],89 objectValuesAll: ['o'],90 equals: ['a', 'b'],91 resolvePath: ['f', 'r'],92 prune: ['a'],93 findSubstr: ['pat', 'str'],94 find: ['value', 'arr'],95 all: ['arr'],96 any: ['arr'],9798 makeArray: ['sz', 'func'],99 pow: ['x', 'n'],100 floor: ['x'],101 ceil: ['x'],102 sqrt: ['x'],103 sin: ['x'],104 cos: ['x'],105 tan: ['x'],106 asin: ['x'],107 acos: ['x'],108 atan: ['x'],109 atan2: ['y', 'x'],110 type: ['x'],111 filter: ['func', 'arr'],112 objectHasEx: ['obj', 'fname', 'hidden'],113 length: ['x'],114 objectFieldsEx: ['obj', 'hidden'],115 codepoint: ['str'],116 char: ['n'],117 log: ['x'],118 log2: ['x'],119 log10: ['x'],120 exp: ['x'],121 mantissa: ['x'],122 exponent: ['x'],123 modulo: ['x', 'y'],124 extVar: ['x'],125 primitiveEquals: ['x', 'y'],126 native: ['x'],127 md5: ['s'],128 trace: ['str', 'rest'],129 parseJson: ['str'],130 parseYaml: ['str'],131 encodeUTF8: ['str'],132 decodeUTF8: ['arr', 'lossy'],133134 sum: ['arr'],135 avg: ['arr', 'onEmpty'],136 minArray: ['arr', 'keyF', 'onEmpty'],137 maxArray: ['arr', 'keyF', 'onEmpty'],138 remove: ['arr', 'elem'],139 contains: ['arr', 'elem'],140 removeAt: ['arr', 'at'],141142 equalsIgnoreCase: ['str1', 'str2'],143 isEmpty: ['str'],144145 xor: ['x', 'y'],146 xnor: ['x', 'y'],147 isInteger: ['x'],148 isDecimal: ['x'],149 isEven: ['x'],150 isOdd: ['x'],151 round: ['x'],152153 sha1: ['str'],154 sha256: ['str'],155 sha512: ['str'],156 sha3: ['str'],157158 objectKeysValues: ['o'],159 objectKeysValuesAll: ['o'],160 objectRemoveKey: ['obj', 'key'],161162 163 __compare: ['v1', 'v2'],164 __compare_array: ['arr1', 'arr2'],165 __array_less: ['arr1', 'arr2'],166 __array_greater: ['arr1', 'arr2'],167 __array_less_or_equal: ['arr1', 'arr2'],168 __array_greater_or_equal: ['arr1', 'arr2'],169170 deg2rad: ['x'],171 rad2deg: ['x'],172 hypot: ['x', 'y'],173};174175std.all(std.map(function(key) assertNames(key, names[key]), std.objectFields(names)))176&& std.all([177 assert std.objectHasAll(names, key): ('function "%s" is not defined in names'178 % key); true,179 for key in std.objectFieldsAll(std)180 if key != 'thisFile' && key != 'pi'181])