Compatibility
| What is currently supported What is not supported yet |
njs is created in compliance with ECMAScript 5.1 (strict mode) with some ECMAScript 6 and later extensions. The compliance is still evolving.
What is currently supported
- Boolean values, numbers, strings, objects, arrays, functions, and regular expressions
- ES5.1 operators, ES7 exponentiation operators
-
ES5.1 statements:
var,if,else,switch,for,for in,while,do while,break,continue,return,try,catch,throw,finally -
ES6
NumberandMathproperties and methods -
Stringmethods:-
ES5.1:
fromCharCode,concat,slice,substring,substr,charAt,indexOf,lastIndexOf,toLowerCase,toUpperCase,trim,search,match,split,replace -
ES6:
fromCodePoint,codePointAt,includes,startsWith,endsWith,repeat -
ES8:
padStart,padEnd -
non-standard:
bytesFrom(0.2.3)fromUTF8,toUTF8,fromBytes,toBytes
-
ES5.1:
-
Objectmethods: -
Arraymethods:-
ES5.1:
isArray,slice,splice,push,pop,unshift,shift,reverse,sort,join,concat,indexOf,lastIndexOf,forEach,some,every,filter,map,reduce,reduceRight -
ES6:
of,fill,find,findIndex -
ES7:
includes
-
ES5.1:
-
ES5.1
Functionmethods:call,apply,bind -
ES5.1
RegExpmethods:test,exec -
ES5.1
Datemethods -
ES5.1
JSONobject -
ES5.1
argumentsobject (0.2.5) - ES6 rest parameters syntax (without destructuring support) (0.2.7)
-
ES5.1 global functions:
isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent -
Errorobjects:Error,EvalError,InternalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError -
setTimeoutandclearTimeoutfunctions (0.2.0) -
Node.js style
File systemmethods:fs.readFileSync,fs.appendFileSync,fs.writeFileSync -
Node.js style
Cryptomethods (0.2.0):crypto.createHash,crypto.createHmac
What is not supported yet
-
ES6
letandconstdeclarations - labels
-
evalfunction -
new Function()constructor -
setInterval,setImmediatefunctions
