Post-ES5 features

This page summarizes features implemented from ES2015 (ES6), ES2016 (ES7), and later. Custom features like Node.js Buffer and WHATWG Encoding API are also listed.

Many of the features can be disabled through config options such as DUK_USE_ES6_PROXY and DUK_USE_BUFFEROBJECT_SUPPORT.

Duktape status is also updated for new releases in kangax/compat-table.


Feature Specification Status Duktape
Duktape object Duktape n/a 1.0.0 Object providing Duktape specific operations like inspecting values, forcing a garbage collection run, etc.
Proxy object ES2015 Partial 1.0.0 Partial support, see separate Proxy trap support table below.
Object.setPrototypeOf() ES2015 Full 1.0.0 Object.setPrototypeOf() allows user to set the internal prototype of an object which is not supported in ECMAScript E5.
Object.prototype.proto ES2015 Annex B Partial 1.0.0 Object.prototype.proto is a setter/getter which provides the same functionality as Object.getPrototypeOf() and Object.setPrototypeOf() but is compatible with existing code base which has relied on a non-standard proto property for a while. The property is not available for "bare objects". Duktape does not support proto property name in an object initializer.
Additional RegExp syntax ES2015 Annex B Partial 1.0.0 Support for non-ES5 RegExp forms (most of them described in ES2015 Annex B) has been added incrementally over releases.
ArrayBuffer ES2015 Partial 1.3.0 Original Duktape implementation was based on the Khronos specification. Detached ArrayBuffers are not yet supported.
Typed arrays ES2015 Partial 1.3.0 Original Duktape implementation was based on the Khronos specification.
DataView ES2015 Partial 1.3.0 Original Duktape implementation was based on the Khronos specification.
Node.js Buffer Node.js v6.9.1 Partial 1.3.0 Original implementation was based on Node.js Buffer v0.12.1, current goal is Node.js v6.9.1 but not all methods are yet implemented. Duktape tracks the latest Node.js Buffer API.
const declaration ES2015 Partial 1.4.0 Support is partial, const is mostly just an alias for var except that an initializer is required: const variables are writable and function scope rather than block scope.
Computed property names ES2015 Partial 2.0.0 Computed method name in object literal not yet supported. Example: { [1+2]: 'three' }.
Octal number literal ES2015 Full 2.0.0 Example: 0o755. Legacy octal literals like 0755 are also supported.
Binary number literal ES2015 Full 2.0.0 Example: 0b10001010.
Unicode escape ES2015 Partial 2.0.0 The escape syntax is allowed in both string literals and identifier names. Not yet supported in RegExps (requires /u flag support which is not yet implemented). Non-BMP escapes decode to surrogate pairs. Example: "pile of ".
Reflect object ES2015 Partial 2.0.0 Provides access to several fundamental ECMAScript primitives as function calls. For example, Reflect.construct() behaves like new. Currently has some limitations, e.g. explicit newTarget is not supported in Reflect.construct().
ES2015 enumeration order ES2015 Full 2.0.0 Object.getOwnPropertyNames() follows the ES2015 [[OwnPropertyKeys]] enumeration order: (1) array indices in ascending order, (2) other properties in insertion order, (3) symbols in insertion order. While ES2015 or ES2016 don't require it, Duktape follows this same order also for for-in, Object.keys(), and duk_enum() in general. As in V8, the rule is applied for every "inheritance level" in turn, i.e. inherited non-duplicate properties always follow child properties.
Exponentiation operator ES2016 Full 2.0.0 Example: x ** y, x **= y.
RegExp getter lenience ES2017 draft n/a 2.0.0 RegExp.prototype.flags and other getters accept the RegExp.prototype object as a this binding without throwing a TypeError. See RegExp.prototype issues.
Symbol object ES2015 Full 2.0.0 Experimental, Symbol binding is disabled by default in Duktape 2.0.0, enable using DUK_USE_SYMBOL_BUILTIN.
Encoding API WHATWG Full 2.0.0 TextEncoder() and TextDecoder(), supports UTF-8 encoding.
"global" binding TC39 proposal Full 2.1.0 Experimental, named binding "global" for the global object. Disabled by default, enable using DUK_USE_GLOBAL_BINDING.
HTML comment syntax ES2015 Full 2.1.0 HTML comments syntax, recognizing <!-- and --> as specified in ES2015 Annex B.1.3. ES2015 Full 2.2.0 syntax.
defineGetter, etc ES2017 Full 2.2.0 Annex B Object.prototype.{__defineGetter,defineSetter} and Object.prototype.{lookupGetter,lookupSetter}, also used in a lot of legacy code.
performance W3C Partial 2.2.0 W3C High Resolution Time API with sub-millisecond resolution (when platform provides it).
ES2015 Number built-in ES2015 Full 2.3.0 New Number built-in properties from ES2015, e.g. EPSILON, MAX_SAFE_INTEGER, parseInt(), parseFloat().
ES2016 Number built-in ES2016 Full 2.3.0 New Number built-in properties from ES2016, only MIN_SAFE_INTEGER.
@@hasInstance ES2015 Full 2.3.0 @@hasInstance well-known symbol support in instanceof.
@@toStringTag ES2015 Full 2.3.0 @@toStringTag well-known symbol support in Object.prototype.toString().
@@toPrimitive ES2015 Full 2.3.0 @@toPrimitive well-known symbol support in ToPrimitive().
@@isConcatSpreadable ES2015 Full 2.3.0 @@isConcatSpreadable well-known symbol support in Array.prototype.concat.

Proxy handlers (traps)

The ECMAScript ES2015 Proxy object allows property virtualization and fine-grained access control for accessing an underlying plain object. Duktape implements a strict subset of the Proxy object from ES2015. Status of trap implementation:

Trap Implemented in version Notes
getPrototypeOf no
setPrototypeOf no
isExtensible no
preventExtension no
getOwnPropertyDescriptor no
defineProperty no
has 1.0.0 Object.hasOwnProperty() does not invoke the trap at the moment, key in obj does.
get 1.0.0
set 1.0.0
deleteProperty 1.0.0
enumerate removed The "enumerate" trap was removed in ES2016 and for-in uses "ownKeys" trap; Duktape 1.x supports "enumerate" trap in for-in.
ownKeys 1.0.0 Some trap result validation (non-configurable properties, non-extensible target) not yet implemented.
apply 2.2.0
construct 2.2.0 Some limitations for and .prototype lookup.

Duktape specific behavior:

Limitations include: