@corefunc/corefunc
Advanced tools
Comparing version 0.0.74 to 0.0.75
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -11,7 +11,4 @@ "use strict"; | ||
*/ | ||
function castToFloat(variable, onFail) { | ||
if (onFail === void 0) { | ||
onFail = 0; | ||
} | ||
var type = typeof variable; | ||
function castToFloat(variable, onFail = 0) { | ||
const type = typeof variable; | ||
if (type === "boolean") { | ||
@@ -21,3 +18,3 @@ return Number(variable); | ||
if (type === "string") { | ||
var temporary = Number.parseFloat(variable); | ||
const temporary = Number.parseFloat(variable); | ||
if (Number.isNaN(temporary) || !Number.isFinite(temporary)) { | ||
@@ -24,0 +21,0 @@ return onFail; |
@@ -17,15 +17,15 @@ { | ||
"devDependencies": { | ||
"@babel/core": "7.10.3", | ||
"@babel/plugin-proposal-class-properties": "7.10.1", | ||
"@babel/preset-env": "7.10.3", | ||
"@types/node": "14.0.13", | ||
"@typescript-eslint/eslint-plugin": "3.3.0", | ||
"@typescript-eslint/parser": "3.3.0", | ||
"@babel/core": "7.11.4", | ||
"@babel/plugin-proposal-class-properties": "7.10.4", | ||
"@babel/preset-env": "7.11.0", | ||
"@types/node": "14.6.0", | ||
"@typescript-eslint/eslint-plugin": "3.10.1", | ||
"@typescript-eslint/parser": "3.10.1", | ||
"babel-core": "7.0.0-bridge.0", | ||
"babel-eslint": "10.1.0", | ||
"eslint": "7.3.0", | ||
"eslint": "7.7.0", | ||
"eslint-config-prettier": "6.11.0", | ||
"eslint-config-standard": "14.1.1", | ||
"eslint-plugin-import": "2.21.2", | ||
"eslint-plugin-jsdoc": "27.1.2", | ||
"eslint-plugin-import": "2.22.0", | ||
"eslint-plugin-jsdoc": "30.3.0", | ||
"eslint-plugin-node": "11.1.0", | ||
@@ -35,7 +35,7 @@ "eslint-plugin-prettier": "3.1.4", | ||
"eslint-plugin-standard": "4.0.1", | ||
"jest": "26.0.1", | ||
"jest": "26.4.2", | ||
"npm-check": "5.9.2", | ||
"prettier": "2.0.5", | ||
"prettier": "2.1.1", | ||
"tslint-config-standard": "9.0.0", | ||
"typescript": "3.9.5" | ||
"typescript": "4.0.2" | ||
}, | ||
@@ -69,3 +69,3 @@ "directories": { | ||
}, | ||
"version": "0.0.74" | ||
"version": "0.0.75" | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const checkIsPrimitive = require("../check/isPrimitive.js").default; | ||
const isPrimitive_1 = require("../check/isPrimitive"); | ||
function isEmpty(value) { | ||
if (value === null || value === undefined) { | ||
return true; | ||
} | ||
if (checkIsPrimitive(value)) { | ||
return true; | ||
} | ||
if (Array.isArray(value)) { | ||
return Boolean(value.length); | ||
} | ||
if (value instanceof Set) { | ||
return Boolean(value.size); | ||
} | ||
if (value instanceof Map) { | ||
return Boolean(value.size); | ||
} | ||
return Boolean(Object.keys(value).length); | ||
if (value === null || value === undefined) { | ||
return true; | ||
} | ||
if (isPrimitive_1.default(value)) { | ||
if (typeof value === "string") { | ||
return !value.length; | ||
} | ||
return Boolean(value); | ||
} | ||
if (Array.isArray(value)) { | ||
return Boolean(value.length); | ||
} | ||
if (value instanceof Set) { | ||
return Boolean(value.size); | ||
} | ||
if (value instanceof Map) { | ||
return Boolean(value.size); | ||
} | ||
return Boolean(Object.keys(value).length); | ||
} | ||
exports.default = isEmpty; |
@@ -8,3 +8,6 @@ import checkIsPrimitive from "../check/isPrimitive"; | ||
if (checkIsPrimitive(value)) { | ||
return true; | ||
if (typeof value === "string") { | ||
return !value.length; | ||
} | ||
return Boolean(value); | ||
} | ||
@@ -11,0 +14,0 @@ if (Array.isArray(value)) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
247534
512
7998