@corefunc/corefunc
Advanced tools
Comparing version 0.0.73 to 0.0.74
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -12,33 +12,33 @@ "use strict"; | ||
function arrayGetUnique(array, sort = true) { | ||
if (array.length < 2) { | ||
return array; | ||
} | ||
let unique = [...new Set(array)]; | ||
if (unique.includes(0)) { | ||
const zeroes = array.filter((value) => value === 0); | ||
if (zeroes.length > 1 && zeroes.some((value) => 1 / value === Number.NEGATIVE_INFINITY)) { | ||
unique.push(-0); | ||
if (array.length < 2) { | ||
return array; | ||
} | ||
} | ||
if (unique.filter((value) => typeof value === "string").length) { | ||
const strings = array.filter((value) => typeof value === "string"); | ||
if (strings.length > 1) { | ||
const normalized = [...new Set(strings.map((value) => value.normalize()))]; | ||
normalized.forEach((value) => { | ||
delete unique[unique.indexOf(value)]; | ||
}); | ||
const compacted = []; | ||
for (let index = 0; index < unique.length; index++) { | ||
if (index in unique) { | ||
compacted.push(unique[index]); | ||
let unique = [...new Set(array)]; | ||
if (unique.includes(0)) { | ||
const zeroes = array.filter((value) => value === 0); | ||
if (zeroes.length > 1 && zeroes.some((value) => 1 / value === Number.NEGATIVE_INFINITY)) { | ||
unique.push(-0); | ||
} | ||
} | ||
unique = compacted.concat(normalized); | ||
} | ||
} | ||
if (sort) { | ||
return unique.sort(); | ||
} | ||
return unique; | ||
if (unique.filter((value) => typeof value === "string").length) { | ||
const strings = array.filter((value) => typeof value === "string"); | ||
if (strings.length > 1) { | ||
const normalized = [...new Set(strings.map((value) => value.normalize()))]; | ||
normalized.forEach((value) => { | ||
delete unique[unique.indexOf(value)]; | ||
}); | ||
const compacted = []; | ||
for (let index = 0; index < unique.length; index++) { | ||
if (index in unique) { | ||
compacted.push(unique[index]); | ||
} | ||
} | ||
unique = compacted.concat(normalized); | ||
} | ||
} | ||
if (sort) { | ||
return unique.sort(); | ||
} | ||
return unique; | ||
} | ||
exports.default = arrayGetUnique; |
@@ -9,4 +9,4 @@ "use strict"; | ||
function arrayIsEmpty(array) { | ||
return array.length === 0; | ||
return array.length === 0; | ||
} | ||
exports.default = arrayIsEmpty; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -8,14 +8,14 @@ "use strict"; | ||
function castToString(value) { | ||
if (value === null || value === undefined) { | ||
return ""; | ||
} | ||
if (typeof value === "string") { | ||
return value; | ||
} | ||
const result = value.toString(); | ||
if (result === "0" && Object.is(value, -0)) { | ||
return "-0"; | ||
} | ||
return result; | ||
if (value === null || value === undefined) { | ||
return ""; | ||
} | ||
if (typeof value === "string") { | ||
return value; | ||
} | ||
const result = value.toString(); | ||
if (result === "0" && Object.is(value, -0)) { | ||
return "-0"; | ||
} | ||
return result; | ||
} | ||
exports.default = castToString; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -8,7 +8,7 @@ "use strict"; | ||
function isFunction(value) { | ||
if (Object.prototype.toString.call(value) !== "[object Function]") { | ||
return false; | ||
} | ||
return !/^class\s/.test(Function.prototype.toString.call(value)); | ||
if (Object.prototype.toString.call(value) !== "[object Function]") { | ||
return false; | ||
} | ||
return !/^class\s/.test(Function.prototype.toString.call(value)); | ||
} | ||
exports.default = isFunction; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -9,4 +9,4 @@ "use strict"; | ||
function objectGetKeys(object) { | ||
return Object.keys(object).sort((alpha, beta) => alpha.localeCompare(beta)); | ||
return Object.keys(object).sort((alpha, beta) => alpha.localeCompare(beta)); | ||
} | ||
exports.default = objectGetKeys; |
@@ -17,17 +17,17 @@ { | ||
"devDependencies": { | ||
"@babel/core": "7.10.2", | ||
"@babel/core": "7.10.3", | ||
"@babel/plugin-proposal-class-properties": "7.10.1", | ||
"@babel/preset-env": "7.10.2", | ||
"@babel/preset-env": "7.10.3", | ||
"@types/node": "14.0.13", | ||
"@typescript-eslint/eslint-plugin": "3.2.0", | ||
"@typescript-eslint/parser": "3.2.0", | ||
"@typescript-eslint/eslint-plugin": "3.3.0", | ||
"@typescript-eslint/parser": "3.3.0", | ||
"babel-core": "7.0.0-bridge.0", | ||
"babel-eslint": "10.1.0", | ||
"eslint": "7.2.0", | ||
"eslint": "7.3.0", | ||
"eslint-config-prettier": "6.11.0", | ||
"eslint-config-standard": "14.1.1", | ||
"eslint-plugin-import": "2.21.2", | ||
"eslint-plugin-jsdoc": "27.0.6", | ||
"eslint-plugin-jsdoc": "27.1.2", | ||
"eslint-plugin-node": "11.1.0", | ||
"eslint-plugin-prettier": "3.1.3", | ||
"eslint-plugin-prettier": "3.1.4", | ||
"eslint-plugin-promise": "4.2.1", | ||
@@ -68,3 +68,3 @@ "eslint-plugin-standard": "4.0.1", | ||
}, | ||
"version": "0.0.73" | ||
"version": "0.0.74" | ||
} |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
Sorry, the diff of this file is not supported yet
245774
510
7948