@compiled/utils
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -11,7 +11,6 @@ "use strict"; | ||
*/ | ||
var unique = function (arr, getId) { | ||
if (getId === void 0) { getId = function (item) { return item; }; } | ||
return arr.reduce(function (acc, item) { | ||
var id = getId(item); | ||
if (!acc.find(function (find) { return getId(find) === id; })) { | ||
const unique = (arr, getId = (item) => item) => { | ||
return arr.reduce((acc, item) => { | ||
const id = getId(item); | ||
if (!acc.find((find) => getId(find) === id)) { | ||
acc.push(item); | ||
@@ -29,10 +28,6 @@ } | ||
*/ | ||
var flatten = function () { | ||
var arrays = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
arrays[_i] = arguments[_i]; | ||
} | ||
return arrays.reduce(function (acc, arr) { return acc.concat(arr); }, []); | ||
const flatten = (...arrays) => { | ||
return arrays.reduce((acc, arr) => acc.concat(arr), []); | ||
}; | ||
exports.flatten = flatten; | ||
//# sourceMappingURL=array.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createError = void 0; | ||
var createError = function (packageName, group) { | ||
if (group === void 0) { group = ''; } | ||
return function (message) { | ||
return new Error("\n \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557\n\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\n\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\n \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D\n\n @compiled/".concat(packageName, " ").concat(group ? "- ".concat(group) : '', "\n\n ").concat(message, "\n")); | ||
}; | ||
const createError = (packageName, group = '') => (message) => { | ||
return new Error(` | ||
██████╗ ██████╗ ███╗ ███╗██████╗ ██╗██╗ ███████╗██████╗ | ||
██╔════╝██╔═══██╗████╗ ████║██╔══██╗██║██║ ██╔════╝██╔══██╗ | ||
██║ ██║ ██║██╔████╔██║██████╔╝██║██║ █████╗ ██║ ██║ | ||
██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║██║ ██╔══╝ ██║ ██║ | ||
╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ██║███████╗███████╗██████╔╝ | ||
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚══════╝╚═════╝ | ||
@compiled/${packageName} ${group ? `- ${group}` : ''} | ||
${message} | ||
`); | ||
}; | ||
exports.createError = createError; | ||
//# sourceMappingURL=error.js.map |
@@ -11,8 +11,7 @@ "use strict"; | ||
*/ | ||
function hash(str, seed) { | ||
if (seed === void 0) { seed = 0; } | ||
var l = str.length; | ||
var h = seed ^ l; | ||
var i = 0; | ||
var k; | ||
function hash(str, seed = 0) { | ||
let l = str.length; | ||
let h = seed ^ l; | ||
let i = 0; | ||
let k; | ||
while (l >= 4) { | ||
@@ -19,0 +18,0 @@ k = |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.kebabCase = void 0; | ||
var KEBAB_REGEX = /[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g; | ||
const KEBAB_REGEX = /[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g; | ||
/** | ||
@@ -11,4 +11,4 @@ * Transforms a string into kebab-case. | ||
function kebabCase(str) { | ||
return str.replace(KEBAB_REGEX, function (match) { | ||
return "-".concat(match.toLowerCase()); | ||
return str.replace(KEBAB_REGEX, (match) => { | ||
return `-${match.toLowerCase()}`; | ||
}); | ||
@@ -15,0 +15,0 @@ } |
@@ -10,5 +10,5 @@ "use strict"; | ||
*/ | ||
var preserveLeadingComments = function (path) { | ||
const preserveLeadingComments = (path) => { | ||
var _a, _b; | ||
var leadingComments = (_b = (_a = path.node.body) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.leadingComments; | ||
const leadingComments = (_b = (_a = path.node.body) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.leadingComments; | ||
if (leadingComments) { | ||
@@ -15,0 +15,0 @@ path.addComments('leading', leadingComments); |
@@ -7,4 +7,4 @@ "use strict"; | ||
exports.buildSourceMap = void 0; | ||
var convert_source_map_1 = __importDefault(require("convert-source-map")); | ||
var source_map_1 = require("source-map"); | ||
const convert_source_map_1 = __importDefault(require("convert-source-map")); | ||
const source_map_1 = require("source-map"); | ||
/** | ||
@@ -19,5 +19,5 @@ * Used to generate a inline source map for CSS. | ||
function buildSourceMap(offset, code, fileName, sourceRoot) { | ||
var generator = new source_map_1.SourceMapGenerator({ | ||
const generator = new source_map_1.SourceMapGenerator({ | ||
file: fileName, | ||
sourceRoot: sourceRoot, | ||
sourceRoot, | ||
}); | ||
@@ -24,0 +24,0 @@ generator.setSourceContent(fileName, code); |
{ | ||
"name": "@compiled/utils", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "A familiar and performant compile time CSS-in-JS library for React.", | ||
@@ -26,5 +26,5 @@ "homepage": "https://compiledcssinjs.com", | ||
"devDependencies": { | ||
"@babel/traverse": "^7.20.13", | ||
"@babel/traverse": "^7.21.4", | ||
"@types/convert-source-map": "^1.5.2" | ||
} | ||
} |
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
22201
432