@node-cli/utilities
Advanced tools
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../src/utilities.ts"],"sourcesContent":["import { merge, mergeWith, uniqueId } from \"lodash-es\";\n\n/**\n * Converts the first character of string to upper case\n * @param {string} string_ the string to convert\n * @returns {string} the converted string\n */\nexport const upperFirst = (string_: string): string =>\n\tstring_[0].toUpperCase() + string_.slice(1);\n\n/**\n * Converts the first character of string to lower case\n * @param {string} string_ the string to convert\n * @returns {string} the converted string\n */\nexport const lowerFirst = (string_: string): string =>\n\tstring_[0].toLowerCase() + string_.slice(1);\n\n/**\n * Generate a random number to append to an `id` string.\n *\n * NOTE: we are still using the good old lodash uniqueId when\n * the code is not in production, so that the results are a\n * little bit more consistent tests after test instead of\n * being completely random, so that they do not break\n * potential snapshot tests.\n *\n * @param {String} prefix - When a prefix is provided, the\n * function will return a random\n * number appended to the provided\n * prefix.\n *\n * @returns {String} - Returns a string with random numbers.\n */\nexport const uniqueID = (prefix: string = \"\"): string => {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\treturn uniqueId(prefix);\n\t}\n\t// Extract the decimal part\n\tconst randomNumber = `${Math.random()}`.split(\".\")[1];\n\treturn prefix || prefix !== \"\" ? `${prefix}${randomNumber}` : randomNumber;\n};\n\n/**\n * Wrapper method for lodash `merge()` and `mergeWith()` methods.\n *\n * Without the `customizer` function, this method recursively merges own and inherited\n * enumerable string keyed properties of source objects into the destination object.\n * Source properties that resolve to undefined are skipped if a destination value exists.\n * Array and plain object properties are merged recursively. Other objects and value\n * types are overridden by assignment. Source objects are applied from left to right.\n * Subsequent sources overwrite property assignments of previous sources.\n *\n * With the `customizer` function, the behavior is the same except that `customizer` is\n * invoked to produce the merged values of the destination and source properties.\n * If customizer returns undefined, merging is handled by the `fastMerge` instead.\n * The customizer is invoked with six arguments: `(objValue, srcValue, key, object,\n * source, stack)`\n * @param {object} objectA\n * @param {object} objectB\n * @param {function} customizer\n * @returns {object} !! WARNING: this method will mutate objectA\n */\nexport const fastMerge = (\n\tobjectA: any,\n\tobjectB: any,\n\tcustomizer?: any,\n): object => {\n\treturn typeof customizer === \"function\"\n\t\t? mergeWith(objectA, objectB, customizer)\n\t\t: merge(objectA, objectB);\n};\n"],"names":["merge","mergeWith","uniqueId","upperFirst","string_","toUpperCase","slice","lowerFirst","toLowerCase","uniqueID","prefix","process","env","NODE_ENV","randomNumber","Math","random","split","fastMerge","objectA","objectB","customizer"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,KAAK,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,YAAY;AAEvD;;;;CAIC,GACD,OAAO,MAAMC,aAAa,CAACC,UAC1BA,OAAO,CAAC,EAAE,CAACC,WAAW,KAAKD,QAAQE,KAAK,CAAC,GAAG;AAE7C;;;;CAIC,GACD,OAAO,MAAMC,aAAa,CAACH,UAC1BA,OAAO,CAAC,EAAE,CAACI,WAAW,KAAKJ,QAAQE,KAAK,CAAC,GAAG;AAE7C;;;;;;;;;;;;;;;CAeC,GACD,OAAO,MAAMG,WAAW,CAACC,SAAiB,EAAE;IAC3C,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QAC1C,OAAOX,SAASQ;IACjB;IACA,2BAA2B;IAC3B,MAAMI,eAAe,CAAC,EAAEC,KAAKC,MAAM,GAAG,CAAC,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;IACrD,OAAOP,UAAUA,WAAW,KAAK,CAAC,EAAEA,OAAO,EAAEI,aAAa,CAAC,GAAGA;AAC/D,EAAE;AAEF;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,MAAMI,YAAY,CACxBC,SACAC,SACAC;IAEA,OAAO,OAAOA,eAAe,aAC1BpB,UAAUkB,SAASC,SAASC,cAC5BrB,MAAMmB,SAASC;AACnB,EAAE"} | ||
| {"version":3,"sources":["../src/utilities.ts"],"sourcesContent":["import { merge, mergeWith, uniqueId } from \"lodash-es\";\n\n/**\n * Converts the first character of string to upper case\n * @param {string} string_ the string to convert\n * @returns {string} the converted string\n */\nexport const upperFirst = (string_: string): string =>\n\tstring_[0].toUpperCase() + string_.slice(1);\n\n/**\n * Converts the first character of string to lower case\n * @param {string} string_ the string to convert\n * @returns {string} the converted string\n */\nexport const lowerFirst = (string_: string): string =>\n\tstring_[0].toLowerCase() + string_.slice(1);\n\n/**\n * Generate a random number to append to an `id` string.\n *\n * NOTE: we are still using the good old lodash uniqueId when\n * the code is not in production, so that the results are a\n * little bit more consistent tests after test instead of\n * being completely random, so that they do not break\n * potential snapshot tests.\n *\n * @param {String} prefix - When a prefix is provided, the\n * function will return a random\n * number appended to the provided\n * prefix.\n *\n * @returns {String} - Returns a string with random numbers.\n */\nexport const uniqueID = (prefix: string = \"\"): string => {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\treturn uniqueId(prefix);\n\t}\n\t// Extract the decimal part\n\tconst randomNumber = `${Math.random()}`.split(\".\")[1];\n\treturn prefix || prefix !== \"\" ? `${prefix}${randomNumber}` : randomNumber;\n};\n\n/**\n * Wrapper method for lodash `merge()` and `mergeWith()` methods.\n *\n * Without the `customizer` function, this method recursively merges own and inherited\n * enumerable string keyed properties of source objects into the destination object.\n * Source properties that resolve to undefined are skipped if a destination value exists.\n * Array and plain object properties are merged recursively. Other objects and value\n * types are overridden by assignment. Source objects are applied from left to right.\n * Subsequent sources overwrite property assignments of previous sources.\n *\n * With the `customizer` function, the behavior is the same except that `customizer` is\n * invoked to produce the merged values of the destination and source properties.\n * If customizer returns undefined, merging is handled by the `fastMerge` instead.\n * The customizer is invoked with six arguments: `(objValue, srcValue, key, object,\n * source, stack)`\n * @param {object} objectA\n * @param {object} objectB\n * @param {function} customizer\n * @returns {object} !! WARNING: this method will mutate objectA\n */\nexport const fastMerge = (\n\tobjectA: any,\n\tobjectB: any,\n\tcustomizer?: any,\n): object => {\n\treturn typeof customizer === \"function\"\n\t\t? mergeWith(objectA, objectB, customizer)\n\t\t: merge(objectA, objectB);\n};\n"],"names":["merge","mergeWith","uniqueId","upperFirst","string_","toUpperCase","slice","lowerFirst","toLowerCase","uniqueID","prefix","process","env","NODE_ENV","randomNumber","Math","random","split","fastMerge","objectA","objectB","customizer"],"mappings":"AAAA,SAASA,KAAK,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,YAAY;AAEvD;;;;CAIC,GACD,OAAO,MAAMC,aAAa,CAACC,UAC1BA,OAAO,CAAC,EAAE,CAACC,WAAW,KAAKD,QAAQE,KAAK,CAAC,GAAG;AAE7C;;;;CAIC,GACD,OAAO,MAAMC,aAAa,CAACH,UAC1BA,OAAO,CAAC,EAAE,CAACI,WAAW,KAAKJ,QAAQE,KAAK,CAAC,GAAG;AAE7C;;;;;;;;;;;;;;;CAeC,GACD,OAAO,MAAMG,WAAW,CAACC,SAAiB,EAAE;IAC3C,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QAC1C,OAAOX,SAASQ;IACjB;IACA,2BAA2B;IAC3B,MAAMI,eAAe,GAAGC,KAAKC,MAAM,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;IACrD,OAAOP,UAAUA,WAAW,KAAK,GAAGA,SAASI,cAAc,GAAGA;AAC/D,EAAE;AAEF;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,MAAMI,YAAY,CACxBC,SACAC,SACAC;IAEA,OAAO,OAAOA,eAAe,aAC1BpB,UAAUkB,SAASC,SAASC,cAC5BrB,MAAMmB,SAASC;AACnB,EAAE"} |
+9
-4
| { | ||
| "name": "@node-cli/utilities", | ||
| "version": "1.0.2", | ||
| "version": "1.0.3", | ||
| "license": "MIT", | ||
@@ -24,4 +24,5 @@ "author": "Arno Versini", | ||
| "lint": "biome lint src", | ||
| "test": "cross-env-shell NODE_OPTIONS=--experimental-vm-modules jest", | ||
| "test:coverage": "npm run test -- --coverage", | ||
| "test": "vitest run --globals", | ||
| "test:coverage": "vitest run --coverage --globals", | ||
| "test:watch": "vitest --globals", | ||
| "watch": "swc --strip-leading-paths --watch --out-dir dist src" | ||
@@ -32,3 +33,7 @@ }, | ||
| }, | ||
| "gitHead": "d7d79f8f71fb3225e5a214aba3a42a89470d8340" | ||
| "devDependencies": { | ||
| "@vitest/coverage-v8": "3.2.4", | ||
| "vitest": "3.2.4" | ||
| }, | ||
| "gitHead": "2cef8f88aa5316a1789caad2bd7327ca908ccb9f" | ||
| } |
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
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
14078
-0.12%2
Infinity%