@compiled/utils
Advanced tools
Comparing version 0.4.8-66821dadb31affaf9fb2c92310efdf15264ddf91.0 to 0.4.8-82d135f3f499486393e5711e5bed72791fbc0be7.0
@@ -0,2 +1,15 @@ | ||
/** | ||
* Returns an array with unique elements. | ||
* Use `getId` to customize what uniquely identifies each array element. | ||
* | ||
* @param arr | ||
* @param getId | ||
*/ | ||
export declare const unique: <TArrItem extends {}>(arr: TArrItem[], getId?: (item: TArrItem) => any) => TArrItem[]; | ||
export declare const flatten: <TArr extends {}>(...assignments: TArr[][]) => TArr[]; | ||
/** | ||
* Flattens nested arrays into a single array. | ||
* `[1, [2, 3]]` becomes `[1, 2, 3]`. | ||
* | ||
* @param arrays | ||
*/ | ||
export declare const flatten: <TArr extends {}>(...arrays: TArr[][]) => TArr[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Returns an array with unique elements. | ||
* Use `getId` to customize what uniquely identifies each array element. | ||
* | ||
* @param arr | ||
* @param getId | ||
*/ | ||
exports.unique = function (arr, getId) { | ||
@@ -13,9 +20,15 @@ if (getId === void 0) { getId = function (item) { return item; }; } | ||
}; | ||
/** | ||
* Flattens nested arrays into a single array. | ||
* `[1, [2, 3]]` becomes `[1, 2, 3]`. | ||
* | ||
* @param arrays | ||
*/ | ||
exports.flatten = function () { | ||
var assignments = []; | ||
var arrays = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
assignments[_i] = arguments[_i]; | ||
arrays[_i] = arguments[_i]; | ||
} | ||
return assignments.reduce(function (acc, arr) { return acc.concat(arr); }, []); | ||
return arrays.reduce(function (acc, arr) { return acc.concat(arr); }, []); | ||
}; | ||
//# sourceMappingURL=array.js.map |
/** | ||
* Quick hash the result of a string input. | ||
* | ||
* Taken from https://github.com/garycourt/murmurhash-js/blob/master/murmurhash2_gc.js | ||
@@ -3,0 +5,0 @@ * @param str |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Quick hash the result of a string input. | ||
* | ||
* Taken from https://github.com/garycourt/murmurhash-js/blob/master/murmurhash2_gc.js | ||
@@ -5,0 +7,0 @@ * @param str |
@@ -0,1 +1,6 @@ | ||
/** | ||
* Transforms a string into kebab-case. | ||
* | ||
* @param str | ||
*/ | ||
export declare function kebabCase(str: string): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var KEBAB_REGEX = /[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g; | ||
/** | ||
* Transforms a string into kebab-case. | ||
* | ||
* @param str | ||
*/ | ||
function kebabCase(str) { | ||
@@ -5,0 +10,0 @@ return str.replace(KEBAB_REGEX, function (match) { |
{ | ||
"name": "@compiled/utils", | ||
"version": "0.4.8-66821dadb31affaf9fb2c92310efdf15264ddf91.0", | ||
"version": "0.4.8-82d135f3f499486393e5711e5bed72791fbc0be7.0", | ||
"description": "The CSS in JS authoring experience you love without the runtime cost", | ||
@@ -5,0 +5,0 @@ "author": "Michael Dougall", |
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
Sorry, the diff of this file is not supported yet
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
14077
299