On this page
Compatibility
njs is created in compliance with ECMAScript 5.1 (strict mode) with some ECMAScript 6 and later extensions. The compliance is still evolving.
Definitions of njs specific properties and methods not compliant with ECMAScript can be found in Reference. Definitions of njs properties and methods compliant with ECMAScript can be found in ECMAScript specification .
What is currently supported
- Boolean values, numbers, strings, objects, arrays, functions, function constructors (0.3.6), and regular expressions
- ES5.1 operators, ES7 exponentiation operators
- ES5.1 statements:
break,catch,continue,do while,else,finally,for,for in,if,return,switch,throw,try,var,while, labeled statements (0.2.8) Mathproperties:- ES6:
E,LN10,LN2,LOG10E,LOG2E,PI,SQRT1_2,SQRT2
- ES6:
Mathmethods:- ES6:
abs,acos,acosh,asin,asinh,atan,atan2,atanh,cbrt,ceil,clz32,cos,cosh,exp,expm1,floor,fround,hypot,imul,log,log10,log1p,log2,max,min,pow,random,round,sign,sin,sinh,sqrt,tan,tanh,trunc
- ES6:
Numberproperties:- ES6:
EPSILON,MAX_SAFE_INTEGER,MAX_VALUE,MIN_SAFE_INTEGER,MIN_VALUE,NEGATIVE_INFINITY,NaN,POSITIVE_INFINITY
- ES6:
Numbermethods:- ES6:
isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt
- ES6:
Numberinstance methods:Stringmethods:- ES5.1:
fromCharCode - ES6:
fromCodePoint
- ES5.1:
Stringinstance methods:- ES5.1:
charAt,concat,indexOf>,lastIndexOf,match,replace,search,slice,split,substr,substring,toLowerCase,trim,toUpperCase - ES6:
codePointAt,endsWith,includes,repeat,startsWith - ES8:
padEnd,padStart - ES9:
trimEnd(0.3.4),trimStart(0.3.4) - non-standard:
bytesFrom(0.2.3),fromBytes,fromUTF8,toBytes,toUTF8
- ES5.1:
Objectmethods:- ES5.1:
create(support without properties list),defineProperties(accessor descriptors support since 0.3.3),defineProperty(accessor descriptors support since 0.3.3),freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors(0.3.1),getOwnPropertyNames(0.3.1),getPrototypeOf,isExtensible,isFrozen,isSealed,keys,preventExtensions,seal - ES6:
assign(0.3.7) - ES8:
entries(0.2.7),values(0.2.7)
- ES5.1:
Objectinstance methods:Arraymethods:- ES5.1:
isArray - ES6:
of
- ES5.1:
Arrayinstance methods:- ES5.1:
concat,every,filter,forEach,indexOf,join,lastIndexOf,map,pop,push,reduce,reduceRight,reverse,shift,slice,some,sort,splice,unshift - ES6:
copyWithin(0.3.7),fill,find,findIndex - ES7:
includes
- ES5.1:
ArrayBuffermethods (0.3.8):- ES6:
isView
- ES6:
ArrayBufferinstance methods (0.3.8):- ES6:
slice
- ES6:
Typed-arrayconstructors (0.3.8):- ES6:
Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
- ES6:
Typed-arrayinstance methods (0.3.8):- ES6:
copyWithin,fill,join,set,slice,sort(0.4.2),subarray,toString
- ES6:
Promisemethods (0.3.8):- ES6:
reject,resolve
- ES6:
Promiseinstance methods (0.3.8):- ES6:
catch,finally,then
- ES6:
Functioninstance methods:- ES5.1:
apply,bind,call
- ES5.1:
RegExpinstance methods:- ES5.1:
exec,test,toString
- ES5.1:
RegExpES9 named capture groups (0.3.2)Datemethods:- ES5.1:
now,parse,UTC
- ES5.1:
Dateinstance methods:- ES5.1:
getDate,getDay,getFullYear,getHours,getMilliseconds,getMinutes,getMonth,getSeconds,getTime,getTimezoneOffset,getUTCDate,getUTCDay,getUTCFullYear,getUTCHours,getUTCMilliseconds,getUTCMinutes,getUTCMonth,getUTCSeconds,toDateString,toISOString,toLocaleDateString,toLocaleString,toLocaleTimeString,toTimeString,toUTCString,setDate,setFullYear,setHours,setMinutes,setMilliseconds,setMonth,setSeconds,setTime,setUTCDate,setUTCFullYear,setUTCHours,setUTCMilliseconds,setUTCMinutes,setUTCMonth,setUTCSeconds
- ES5.1:
JSONmethods:- ES5.1:
parsestringify
- ES5.1:
- ES5.1
argumentsobject (0.2.5) - ES6 rest parameters syntax (without destructuring support) (0.2.7)
- ES5.1 global functions:
decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,isFinite,isNaN,parseFloat,parseInt Errorobjects:Error,EvalError,InternalError,RangeError,ReferenceError,SyntaxError,TypeError,URIErrorclearTimeoutandsetTimeoutfunctions (0.2.0)File systemmethods:fs.accessSync(0.3.9),fs.appendFileSync,fs.mkdirSync(0.4.2),fs.readdirSync(0.4.2),fs.readFileSync,fs.realpathSync(0.3.9),fs.renameSync(0.3.4),fs.rmdirSync(0.4.2),fs.symlinkSync(0.3.9),fs.unlinkSync(0.3.9),fs.writeFileSyncfs.promisesAPI (0.3.9), asynchronous version of file system methods.Cryptomethods (0.2.0):crypto.createHash,crypto.createHmac- ES6 modules support: default
exportand defaultimportstatements (0.3.0) - ES6 arrow functions (0.3.1)
- Template literals: multiline strings, expression interpolation, nesting templates (0.3.2)
- Global objects (0.3.3):