es5-ext
Advanced tools
Comparing version 0.10.37 to 0.10.38
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="0.10.38"></a> | ||
## [0.10.38](https://github.com/medikoo/es5-ext/compare/v0.10.37...v0.10.38) (2018-01-16) | ||
### Features | ||
* Object.isNaturalNumber an Object.isNaturalNumberValue ([66a40af](https://github.com/medikoo/es5-ext/commit/66a40af)) | ||
<a name="0.10.37"></a> | ||
@@ -7,0 +17,0 @@ ## [0.10.37](https://github.com/medikoo/es5-ext/compare/v0.10.36...v0.10.37) (2017-11-23) |
@@ -11,18 +11,18 @@ "use strict"; | ||
var deepAssign = function (source, target) { | ||
if (isPlainObject(source)) { | ||
if (!isPlainObject(target)) return target; | ||
objForEach(target, function (value, key) { | ||
source[key] = deepAssign(source[key], value); | ||
var deepAssign = function (target, source) { | ||
if (isPlainObject(target)) { | ||
if (!isPlainObject(source)) return source; | ||
objForEach(source, function (value, key) { | ||
target[key] = deepAssign(target[key], value); | ||
}); | ||
return source; | ||
return target; | ||
} | ||
if (isArray(source)) { | ||
if (!isArray(target)) return target; | ||
target.forEach(function (item) { | ||
if (!includes.call(source, item)) source.push(item); | ||
if (isArray(target)) { | ||
if (!isArray(source)) return source; | ||
source.forEach(function (item) { | ||
if (!includes.call(target, item)) target.push(item); | ||
}); | ||
return source; | ||
return target; | ||
} | ||
return target; | ||
return source; | ||
}; | ||
@@ -29,0 +29,0 @@ |
"use strict"; | ||
var ensure = require("./ensure-natural-number") | ||
, isValue = require("./is-value"); | ||
var isNaturalValue = require("./is-natural-number-value") | ||
, toShortString = require("../to-short-string-representation"); | ||
module.exports = function (arg) { | ||
if (!isValue(arg)) throw new TypeError(arg + " is not a natural number"); | ||
return ensure(arg); | ||
var num = Number(arg); | ||
if (!isNaturalValue(arg)) throw new TypeError(toShortString(arg) + " is not a natural number"); | ||
return num; | ||
}; |
"use strict"; | ||
var isNatural = require("../number/is-natural"); | ||
var isNatural = require("../number/is-natural") | ||
, toShortString = require("../to-short-string-representation"); | ||
module.exports = function (arg) { | ||
var num = Number(arg); | ||
if (!isNatural(num)) throw new TypeError(arg + " is not a natural number"); | ||
if (!isNatural(num)) throw new TypeError(toShortString(arg) + " is not a natural number"); | ||
return num; | ||
}; |
@@ -34,2 +34,4 @@ "use strict"; | ||
isFiniteNumber: require("./is-finite-number"), | ||
isNaturalNumber: require("./is-natural-number"), | ||
isNaturalNumberValue: require("./is-natural-number-value"), | ||
isNumberValue: require("./is-number-value"), | ||
@@ -36,0 +38,0 @@ isObject: require("./is-object"), |
{ | ||
"name": "es5-ext", | ||
"version": "0.10.37", | ||
"version": "0.10.38", | ||
"description": "ECMAScript extensions and shims", | ||
@@ -29,8 +29,8 @@ "author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)", | ||
"dependencies": { | ||
"es6-iterator": "~2.0.1", | ||
"es6-iterator": "~2.0.3", | ||
"es6-symbol": "~3.1.1" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^4.6.1", | ||
"eslint-config-medikoo-es5": "^1.4.4", | ||
"eslint": "^4.15", | ||
"eslint-config-medikoo-es5": "^1.4.7", | ||
"tad": "~0.2.7" | ||
@@ -37,0 +37,0 @@ }, |
511466
794
15881
Updatedes6-iterator@~2.0.3