es-abstract
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -0,1 +1,6 @@ | ||
1.1.1 / 2015-03-19 | ||
================= | ||
* Fix isPrimitive check for functions | ||
* Update `eslint`, `editorconfig-tools`, `semver`, `nsp` | ||
1.1.0 / 2015-02-17 | ||
@@ -2,0 +7,0 @@ ================= |
@@ -48,3 +48,2 @@ 'use strict'; | ||
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive | ||
@@ -51,0 +50,0 @@ ToPrimitive: function ToPrimitive(input, PreferredType) { |
module.exports = function isPrimitive(value) { | ||
return value === null || typeof value !== 'object'; | ||
return value === null || (typeof value !== 'function' && typeof value !== 'object'); | ||
}; |
{ | ||
"name": "es-abstract", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"author": "Jordan Harband", | ||
@@ -40,8 +40,9 @@ "description": "ECMAScript spec abstract operations.", | ||
"jscs": "^1.11.3", | ||
"editorconfig-tools": "^0.0.1", | ||
"nsp": "^1.0.0", | ||
"eslint": "^0.14.1", | ||
"editorconfig-tools": "^0.1.1", | ||
"nsp": "^1.0.1", | ||
"eslint": "^0.17.1", | ||
"object-is": "^1.0.1", | ||
"foreach": "^2.0.5", | ||
"semver": "^4.3.0" | ||
"semver": "^4.3.1", | ||
"replace": "^0.3.0" | ||
}, | ||
@@ -48,0 +49,0 @@ "testling": { |
@@ -8,5 +8,7 @@ var ES = require('../').ES5; | ||
var coercibleObject = { valueOf: function () { return 3; }, toString: function () { return 42; } }; | ||
var coercibleFnObject = { valueOf: function () { return function valueOfFn() {}; }, toString: function () { return 42; } }; | ||
var valueOfOnlyObject = { valueOf: function () { return 4; }, toString: function () { return {}; } }; | ||
var toStringOnlyObject = { valueOf: function () { return {}; }, toString: function () { return 7; } }; | ||
var uncoercibleObject = { valueOf: function () { return {}; }, toString: function () { return {}; } }; | ||
var uncoercibleFnObject = { valueOf: function () { return function valueOfFn() {}; }, toString: function () { return function toStrFn() {}; } }; | ||
var objects = [{}, coercibleObject, toStringOnlyObject, valueOfOnlyObject]; | ||
@@ -29,2 +31,3 @@ var numbers = [0, -0, Infinity, -Infinity, 42]; | ||
st.equal(ES.ToPrimitive(coercibleObject, String), '42', 'coercibleObject with hint String coerces to stringified toString'); | ||
st.equal(ES.ToPrimitive(coercibleFnObject), 42, 'coercibleFnObject coerces to toString'); | ||
st.equal(ES.ToPrimitive(toStringOnlyObject), 7, 'toStringOnlyObject returns non-stringified toString'); | ||
@@ -36,2 +39,3 @@ st.equal(ES.ToPrimitive(valueOfOnlyObject), 4, 'valueOfOnlyObject returns valueOf'); | ||
st.throws(function () { return ES.ToPrimitive(uncoercibleObject); }, TypeError, 'uncoercibleObject throws a TypeError'); | ||
st.throws(function () { return ES.ToPrimitive(uncoercibleFnObject); }, TypeError, 'uncoercibleFnObject throws a TypeError'); | ||
st.end(); | ||
@@ -38,0 +42,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73174
1276
10