通过es-checker检测es6是否支持node当前环境

责编:menVScode 2017-12-28 22:07 阅读(696)

es-checker会检测当前的node版本对es6的支持情况。

小编当前的node的版本为:v6.11.0

全局安装 es-checker

npm install es-checker -g

运行 es-checker 进行检测

es-checker

运行结果:

Variables
  √ let and const
  √ TDZ error for too-early access of let or const declarations
  √ Redefinition of const declarations not allowed
  √ destructuring assignments/declarations for arrays and objects
  √ ... operator

Data Types
  √ For...of loop
  √ Map, Set, WeakMap, WeakSetSymbol
  √ Symbols cannot be implicitly coerced

Number
  √ Octal (e.g. 0o1 ) and binary (e.g. 0b10 ) literal forms
  √ Old octal literal invalid now (e.g. 01 )
  √ Static functions added to Math (e.g. Math.hypot(), Math.acosh(), Math.imul() )
  √ Static functions added to Number (Number.isNaN(), Number.isInteger() )

String
  √ Methods added to String.prototype (String.prototype.includes(), String.prototype.repeat() )
  √ Unicode code-point escape form in string literals (e.g. \u{20BB7} )
  √ Unicode code-point escape form in identifier names (e.g. var \u{20BB7} = 42; )
  √ Unicode code-point escape form in regular expressions (e.g. var regexp = /\u{20BB7}/u; )
  √ y flag for sticky regular expressions (e.g. /b/y )
  √ Template String Literals

Function
  √ arrow functiondefault function parameter valuesdestructuring for function parametersInferences for function name property for anonymous functions
  × Tail-call optimization for function calls and recursion

Array
  × Methods added to Array.prototype ([].fill(), [].find(), [].findIndex(), [].entries(), [].keys(), [].values() )
  √ Static functions added to Array (Array.from(), Array.of() )
  √ TypedArrays like Uint8Array, ArrayBuffer, Int8Array(), Int32Array(), Float64Array()
  √ Some Array methods (e.g. Int8Array.prototype.slice(), Int8Array.prototype.join(), Int8Array.prototype.forEach() ) added to the TypedArray prototypesSome Array statics (e.g. Uint32Array.from(), Uint32Array.of() ) added to the TypedArray constructors

Object__proto__ in object literal definition sets [[Prototype]] linkStatic functions added to Object (Object.getOwnPropertySymbols(), Object.assign() )
  √ Object Literal Computed PropertyObject Literal Property ShorthandsProxiesReflect

Generator and PromiseGenerator functionPromises

ClassClasssuper allowed in object methodsclass ABC extends Array { .. }

Module
  × Module export command
  × Module import command


=========================================
Passes 38 feature Detections
Your runtime supports 90% of ECMAScript 6
=========================================

结果显示:小编当前node环境支持百分之九十的es6语法,那些前面有“×”的符号就代表不支持。接着小编让基友在node版本为v8.1.2环境,进行同样的操作,依旧显示 Module export command 和 Module import command(模块导出和模块导入)不支持当前node环境。

标签: es-checker es6 node
前端交流群: MVC前端网(menvscode.com)-qq交流群:551903636

邮箱快速注册

忘记密码