@cardsgame/utils
Advanced tools
Comparing version 0.8.0 to 0.8.1
/** | ||
* Runs every provided function on `array` using .map(), ignores every function which turns out to be `undefined` instead. | ||
* @throws if one of arg1+ turn out to be something other than Function or undefined. | ||
* Compares if two arrays contain same elements. | ||
*/ | ||
export declare const mapCompose: (array: any[], ...functions: ((...args: any[]) => any)[]) => any[]; | ||
export declare const compare: (arrayA: any[], arrayB: any[]) => boolean; | ||
/** | ||
@@ -19,3 +18,4 @@ * Function for `array.sort()`. | ||
/** | ||
* | ||
* Returns an array which holds `count` items, each being the index | ||
* number starting from 0. | ||
* @param count | ||
@@ -22,0 +22,0 @@ */ |
@@ -23,23 +23,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pickMostCommonProp = exports.arrayWith = exports.shuffle = exports.sortAlphaNumerically = exports.sortAlphabetically = exports.mapCompose = void 0; | ||
exports.pickMostCommonProp = exports.arrayWith = exports.shuffle = exports.sortAlphaNumerically = exports.sortAlphabetically = exports.compare = void 0; | ||
/** | ||
* Runs every provided function on `array` using .map(), ignores every function which turns out to be `undefined` instead. | ||
* @throws if one of arg1+ turn out to be something other than Function or undefined. | ||
* Compares if two arrays contain same elements. | ||
*/ | ||
exports.mapCompose = function (array) { | ||
var functions = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
functions[_i - 1] = arguments[_i]; | ||
} | ||
return functions.reduce(function (prevArr, fn, idx) { | ||
if (typeof fn === "function") { | ||
return prevArr.map(fn); | ||
} | ||
else if (typeof fn === "undefined" || fn === false) { | ||
return prevArr; | ||
} | ||
else { | ||
throw new Error("utils/mapCompose, I expected a function at arg" + (idx + 1) + ", got \"" + typeof fn + "\" instead..."); | ||
} | ||
}, array || []); | ||
exports.compare = function (arrayA, arrayB) { | ||
return arrayA.length === arrayB.length && arrayA.every(function (a) { return arrayB.includes(a); }); | ||
}; | ||
@@ -77,3 +62,4 @@ /** | ||
/** | ||
* | ||
* Returns an array which holds `count` items, each being the index | ||
* number starting from 0. | ||
* @param count | ||
@@ -80,0 +66,0 @@ */ |
@@ -242,3 +242,3 @@ "use strict"; | ||
else if (!isBrowser) { | ||
setLogLevel(process.env.IN_PASSENGER ? "verbose" : process.env.LOGS); | ||
setLogLevel(process.env.LOGS); | ||
} | ||
@@ -245,0 +245,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const deepClone: (value: any) => any; | ||
export declare const deepClone: (value: unknown) => any; | ||
/** | ||
@@ -3,0 +3,0 @@ * @returns an object without provided `keys` |
@@ -14,3 +14,5 @@ "use strict"; | ||
exports.randomName = function () { | ||
var randomLetter = function () { return String.fromCharCode(Math.random() * (90 - 65) + 65); }; | ||
var randomLetter = function () { | ||
return String.fromCharCode(Math.random() * (90 - 65) + 65); | ||
}; | ||
return randomLetter() + randomLetter() + randomLetter(); | ||
@@ -17,0 +19,0 @@ }; |
{ | ||
"name": "@cardsgame/utils", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "", | ||
"author": "Darek Greenly (https://darekgreenly.com)", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/zielak/cardsGame.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/zielak/cardsGame/issues" | ||
}, | ||
"main": "lib/index.js", | ||
@@ -19,3 +26,3 @@ "types": "lib/index.d.ts", | ||
"dependencies": { | ||
"@cardsgame/types": "^0.8.0", | ||
"@cardsgame/types": "^0.8.1", | ||
"@colyseus/schema": "^0.5.30", | ||
@@ -27,3 +34,3 @@ "chalk": "^3.0.0" | ||
}, | ||
"gitHead": "a44fb0f1391342ef8d0ab9a8bac0648afa73ae2d" | ||
"gitHead": "257f5186685594b4d09d326ca9c6c60f24fc2d49" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
0
2
56099
912
Updated@cardsgame/types@^0.8.1