feature-detect-es6
Detect which ES6 (ES2015 and above) features are available.
Example
var detect = require('feature-detect-es6')
if (detect.all('class', 'spread', 'let', 'arrowFunction')){
// safe to run ES6 code natively..
} else {
// run your transpiled ES5..
}
- feature-detect-es6
- .class() ⇒
boolean
- .arrowFunction() ⇒
boolean
- .let() ⇒
boolean
- .const() ⇒
boolean
- .newArrayFeatures() ⇒
boolean
- .newObjectFeatures() ⇒
boolean
- .collections() ⇒
boolean
- .generators() ⇒
boolean
- .promises() ⇒
boolean
- .templateStrings() ⇒
boolean
- .symbols() ⇒
boolean
- .destructuring() ⇒
boolean
- .spread() ⇒
boolean
- .defaultParamValues() ⇒
boolean
- .asyncFunctions() ⇒
boolean
- .all() ⇒
boolean
- .class() ⇒
boolean
detect.class() ⇒ Returns true if the class
statement is available.
Kind: static method of feature-detect-es6
boolean
detect.arrowFunction() ⇒ Returns true if the arrow functions available.
Kind: static method of feature-detect-es6
boolean
detect.let() ⇒ Returns true if the let
statement is available.
Kind: static method of feature-detect-es6
boolean
detect.const() ⇒ Returns true if the const
statement is available.
Kind: static method of feature-detect-es6
boolean
detect.newArrayFeatures() ⇒ Returns true if the new Array features are available (exluding Array.prototype.values
which has zero support anywhere).
Kind: static method of feature-detect-es6
boolean
detect.newObjectFeatures() ⇒ Returns true if the new functions of Object are available.
Kind: static method of feature-detect-es6
boolean
detect.collections() ⇒ Returns true if Map
, WeakMap
, Set
and WeakSet
are available.
Kind: static method of feature-detect-es6
boolean
detect.generators() ⇒ Returns true if generators are available.
Kind: static method of feature-detect-es6
boolean
detect.promises() ⇒ Returns true if Promise
is available.
Kind: static method of feature-detect-es6
boolean
detect.templateStrings() ⇒ Returns true if template strings are available.
Kind: static method of feature-detect-es6
boolean
detect.symbols() ⇒ Returns true if Symbol
is available.
Kind: static method of feature-detect-es6
boolean
detect.destructuring() ⇒ Returns true if destructuring is available.
Kind: static method of feature-detect-es6
boolean
detect.spread() ⇒ Returns true if the spread operator (...
) is available.
Kind: static method of feature-detect-es6
boolean
detect.defaultParamValues() ⇒ Returns true if default parameter values are available.
Kind: static method of feature-detect-es6
boolean
detect.asyncFunctions() ⇒ Returns true if async functions are available.
Kind: static method of feature-detect-es6
boolean
detect.all() ⇒ Returns true if all specified features are detected.
Kind: static method of feature-detect-es6
Param | Type | Description |
---|---|---|
[...feature] | string |
the features to detect. |
Example
var result = detect.all('class', 'spread', 'let', 'arrowFunction')
© 2015-18 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.