Comparing version
1.3.0 / 2014-11-10 | ||
================== | ||
* feat: Supports String checks. (@hemanth) | ||
1.2.0 / 2014-10-31 | ||
@@ -3,0 +8,0 @@ ================== |
31
index.js
@@ -10,2 +10,3 @@ /**! | ||
* dead_horse <dead_horse@qq.com> (http://github.com/dead-horse) | ||
* hemanth.hm <hemanth.hm@gmail.com> (http://h3manth.com) | ||
*/ | ||
@@ -16,2 +17,10 @@ | ||
/** | ||
* Helper functions. | ||
*/ | ||
function isFunction(attr) { | ||
return typeof attr === 'function'; | ||
} | ||
/** | ||
* Module dependencies. | ||
@@ -48,6 +57,20 @@ */ | ||
exports.Object = { | ||
is: typeof Object.is === 'function', | ||
assign: typeof Object.assign === 'function', | ||
getOwnPropertySymbols: typeof Object.getOwnPropertySymbols === 'function', | ||
setPrototypeOf: typeof Object.setPrototypeOf === 'function' | ||
is: isFunction(Object.is), | ||
assign: isFunction(Object.assign), | ||
getOwnPropertySymbols: isFunction(Object.getOwnPropertySymbols), | ||
setPrototypeOf: isFunction(Object.setPrototypeOf) | ||
}; | ||
// String methods. | ||
exports.String = { | ||
raw: isFunction(String.raw), | ||
fromCodePoint: isFunction(String.fromCodePoint), | ||
prototype:{ | ||
codePointAt: isFunction(String.prototype.codePointAt), | ||
normalize: isFunction(String.prototype.normalize), | ||
repeat: isFunction(String.prototype.repeat), | ||
startsWith: isFunction(String.prototype.startsWith), | ||
endsWith: isFunction(String.prototype.endsWith), | ||
contains: isFunction(String.prototype.contains) | ||
} | ||
}; |
{ | ||
"name": "enable", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Detect es6 features enable or not.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -68,2 +68,35 @@ enable | ||
} | ||
if (enable.String.raw) { | ||
console.log('supports `String.raw();`'); | ||
} | ||
if (enable.String.fromCodePoint) { | ||
console.log('supports `String.fromCodePoint`'); | ||
} | ||
if (enable.String.prototype.codePointAt) { | ||
console.log('supports `String.prototype.codePointAt`'); | ||
} | ||
if (enable.String.prototype.normalize) { | ||
console.log('supports `String.prototype.normalize`'); | ||
} | ||
if (enable.String.prototype.repeat) { | ||
console.log('supports `String.prototype.repeat`'); | ||
} | ||
if (enable.String.prototype.startsWith) { | ||
console.log('supports `String.prototype.startsWith`'); | ||
} | ||
if (enable.String.prototype.endsWith) { | ||
console.log('supports `String.prototype.endsWith`'); | ||
} | ||
if (enable.String.prototype.contains) { | ||
console.log('supports `String.prototype.contains`'); | ||
} | ||
``` | ||
@@ -70,0 +103,0 @@ |
8021
21.57%62
47.62%140
30.84%