@takeshape/util
Advanced tools
Comparing version 6.8.0 to 7.3.0
@@ -1,2 +0,2 @@ | ||
export const delay = (timeout, value) => new Promise(resolve => { | ||
export const delay = async (timeout, value) => new Promise(resolve => { | ||
setTimeout(resolve, timeout, value); | ||
@@ -6,3 +6,5 @@ }); | ||
function randomInt(minimum, maximum) { | ||
return Math.floor(Math.random() * (maximum - minimum + 1) + minimum); | ||
// eslint-disable-next-line security-node/detect-insecure-randomness | ||
const co = Math.random() * (maximum - minimum + 1); | ||
return Math.floor(co + minimum); | ||
} // Decorrelated jitter backoff: | ||
@@ -9,0 +11,0 @@ // https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ |
@@ -8,3 +8,3 @@ import upperFirst from 'lodash/upperFirst'; | ||
export function isUuid(str) { | ||
return Boolean(str.match(/\w{8,}(-\w{4,}){3,}-\w{12,}/)); | ||
return Boolean(/\w{8,}(-\w{4,}){3,}-\w{12,}/.exec(str)); | ||
} |
export declare function arrayContainsAll<T>(a: T[], b: T[]): boolean; | ||
export declare function setIsEqual<T>(a: T[], b: T[]): boolean; | ||
export declare function isDefined<T>(x: T | null | undefined): x is T; | ||
//# sourceMappingURL=arrays.d.ts.map |
@@ -7,1 +7,2 @@ export declare const delay: <T>(timeout: number, value?: T | undefined) => Promise<T>; | ||
export declare function backoff(baseDelay: number, maxDelay: number, attempt?: Attempt): Promise<Attempt>; | ||
//# sourceMappingURL=delay.d.ts.map |
@@ -9,3 +9,3 @@ "use strict"; | ||
const delay = (timeout, value) => new Promise(resolve => { | ||
const delay = async (timeout, value) => new Promise(resolve => { | ||
setTimeout(resolve, timeout, value); | ||
@@ -17,3 +17,5 @@ }); | ||
function randomInt(minimum, maximum) { | ||
return Math.floor(Math.random() * (maximum - minimum + 1) + minimum); | ||
// eslint-disable-next-line security-node/detect-insecure-randomness | ||
const co = Math.random() * (maximum - minimum + 1); | ||
return Math.floor(co + minimum); | ||
} // Decorrelated jitter backoff: | ||
@@ -20,0 +22,0 @@ // https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ |
@@ -5,1 +5,2 @@ /// <reference types="node" /> | ||
export declare const gunzip: (input: GzipInputType) => Promise<Buffer>; | ||
//# sourceMappingURL=gzip.d.ts.map |
@@ -8,1 +8,2 @@ export * from './types'; | ||
export * from './arrays'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -11,2 +11,3 @@ "use strict"; | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _types[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -24,2 +25,3 @@ enumerable: true, | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _mime[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -37,2 +39,3 @@ enumerable: true, | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _gzip[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -50,2 +53,3 @@ enumerable: true, | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _delay[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -63,2 +67,3 @@ enumerable: true, | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _strings[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -76,2 +81,3 @@ enumerable: true, | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _unixToIso[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -89,2 +95,3 @@ enumerable: true, | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _arrays[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -91,0 +98,0 @@ enumerable: true, |
@@ -13,1 +13,2 @@ /** | ||
export declare function shouldCompress(src: string): boolean; | ||
//# sourceMappingURL=mime.d.ts.map |
export declare const camelCase: (str: string | string[]) => string; | ||
export declare function upperCamel(str: string | string[]): string; | ||
export declare function isUuid(str: string): boolean; | ||
//# sourceMappingURL=strings.d.ts.map |
@@ -24,3 +24,3 @@ "use strict"; | ||
function isUuid(str) { | ||
return Boolean(str.match(/\w{8,}(-\w{4,}){3,}-\w{12,}/)); | ||
return Boolean(/\w{8,}(-\w{4,}){3,}-\w{12,}/.exec(str)); | ||
} |
export declare type StringProps<Obj> = { | ||
[K in keyof Required<Obj>]: Obj[K] extends string ? K : never; | ||
}[keyof Obj]; | ||
export declare function isObject(obj: unknown): obj is { | ||
[name: string]: unknown; | ||
}; | ||
export declare function isObject(obj: unknown): obj is Record<string, unknown>; | ||
export declare type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>; | ||
export declare type Maybe<T> = T | undefined; | ||
//# sourceMappingURL=types.d.ts.map |
export declare function unixToISO(unix: number): string; | ||
//# sourceMappingURL=unix-to-iso.d.ts.map |
{ | ||
"name": "@takeshape/util", | ||
"version": "6.8.0", | ||
"version": "7.3.0", | ||
"description": "Shared utilities", | ||
"homepage": "https://www.takeshape.io", | ||
@@ -11,2 +12,5 @@ "repository": { | ||
"license": "UNLICENSED", | ||
"engines": { | ||
"node": ">=12 <15" | ||
}, | ||
"main": "lib/index.js", | ||
@@ -19,49 +23,21 @@ "module": "es/index.js", | ||
], | ||
"description": "TakeShape Util", | ||
"scripts": { | ||
"lint": "eslint --ext .js --ext .ts --ignore-path .gitignore src", | ||
"lint": "eslint . --ext .js,.ts", | ||
"lint:code:ci": "eslint . --ext .js,.ts --format junit -o \"${HOME}/test-results/${npm_package_name#*\\/}/eslint-results.xml\"", | ||
"test": "jest", | ||
"test-changed": "pnpm run test -- --changedSince=master", | ||
"typecheck": "tsc -p tsconfig.check.json", | ||
"clean": "rimraf lib es tsconfig.tsbuildinfo", | ||
"prepublishOnly": "pnpm run lint && pnpm run test && pnpm run clean && pnpm run build", | ||
"build": "pnpm run build:types && pnpm run build:js && pnpm run build:es", | ||
"build:types": "tsc --emitDeclarationOnly", | ||
"test:ci": "JEST_JUNIT_OUTPUT_DIR=\"${HOME}/test-results/${npm_package_name#*\\/}\" JEST_JUNIT_OUTPUT_NAME=jest-results.xml jest --ci --reporters=default --reporters=jest-junit", | ||
"typecheck": "tsc --noEmit", | ||
"clean": "rimraf lib es build *.tsbuildinfo", | ||
"prepublishOnly": "pnpm lint && pnpm test && pnpm clean && pnpm build", | ||
"build": "pnpm clean && pnpm build:types && pnpm build:js && pnpm build:es && pnpm build:copy", | ||
"build:types": "tsc --emitDeclarationOnly --project tsconfig.build.json", | ||
"build:js": "cross-env BABEL_MODULES=commonjs babel src --out-dir lib --extensions \".js,.ts\" --ignore '**/__tests__'", | ||
"build:es": "cross-env BABEL_MODULES=es babel src --out-dir es --extensions \".js,.ts\" --ignore '**/__tests__'" | ||
"build:es": "cross-env BABEL_MODULES=es babel src --out-dir es --extensions \".js,.ts\" --ignore '**/__tests__'", | ||
"build:copy": "cp -rf build/src/* lib/", | ||
"will-it-blend": "pnpm typecheck && pnpm lint -- --quiet && pnpm test -- --silent --coverage false" | ||
}, | ||
"jest": { | ||
"testEnvironment": "node", | ||
"moduleFileExtensions": [ | ||
"js", | ||
"json", | ||
"jsx", | ||
"ts", | ||
"tsx", | ||
"d.ts", | ||
"node" | ||
], | ||
"transform": { | ||
"^.+\\.[t|j]sx?$": "babel-jest" | ||
}, | ||
"roots": [ | ||
"src" | ||
], | ||
"testMatch": [ | ||
"**/*.test.js", | ||
"**/*.test.ts" | ||
], | ||
"collectCoverage": true, | ||
"collectCoverageFrom": [ | ||
"src/**/*.js", | ||
"src/**/*.ts" | ||
], | ||
"coveragePathIgnorePatterns": [ | ||
"/node_modules/", | ||
".*/__tests__/.*" | ||
] | ||
}, | ||
"keywords": [], | ||
"dependencies": { | ||
"lodash": "^4.17.15", | ||
"aws-sdk": "^2.802.0", | ||
"lodash": "^4.17.20", | ||
"mime-types": "^2.1.27", | ||
@@ -71,3 +47,3 @@ "pify": "^5.0.0" | ||
"devDependencies": { | ||
"@types/lodash": "^4.14.157", | ||
"@types/lodash": "^4.14.165", | ||
"@types/mime-types": "^2.1.0", | ||
@@ -74,0 +50,0 @@ "@types/pify": "^3.0.2" |
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
23419
42
459
4
+ Addedaws-sdk@^2.802.0
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedaws-sdk@2.1692.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbuffer@4.9.2(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedevents@1.1.1(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedieee754@1.1.13(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-arguments@1.1.1(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-generator-function@1.0.10(transitive)
+ Addedis-typed-array@1.1.13(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedjmespath@0.16.0(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedpunycode@1.3.2(transitive)
+ Addedquerystring@0.2.0(transitive)
+ Addedsax@1.2.1(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedurl@0.10.3(transitive)
+ Addedutil@0.12.5(transitive)
+ Addeduuid@8.0.0(transitive)
+ Addedwhich-typed-array@1.1.15(transitive)
+ Addedxml2js@0.6.2(transitive)
+ Addedxmlbuilder@11.0.1(transitive)
Updatedlodash@^4.17.20