fast-unique-numbers
Advanced tools
Comparing version
@@ -5,3 +5,3 @@ /* | ||
*/ | ||
const MAX_SAFE_INTEGER = (Number.MAX_SAFE_INTEGER === undefined) ? 9007199254740991 : Number.MAX_SAFE_INTEGER; | ||
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER === undefined ? 9007199254740991 : Number.MAX_SAFE_INTEGER; | ||
const TWO_TO_THE_POWER_OF_TWENTY_NINE = 536870912; | ||
@@ -20,7 +20,3 @@ const TWO_TO_THE_POWER_OF_THIRTY = TWO_TO_THE_POWER_OF_TWENTY_NINE * 2; | ||
*/ | ||
let nextNumber = (lastNumber === undefined) | ||
? collection.size | ||
: (lastNumber < TWO_TO_THE_POWER_OF_THIRTY) | ||
? lastNumber + 1 | ||
: 0; | ||
let nextNumber = lastNumber === undefined ? collection.size : lastNumber < TWO_TO_THE_POWER_OF_THIRTY ? lastNumber + 1 : 0; | ||
if (!collection.has(nextNumber)) { | ||
@@ -27,0 +23,0 @@ return cache(collection, nextNumber); |
186
package.json
{ | ||
"author": "Christoph Guttandin", | ||
"browser": "build/es5/bundle.js", | ||
"bugs": { | ||
"url": "https://github.com/chrisguttandin/fast-unique-numbers/issues" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "cz-conventional-changelog" | ||
} | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.10.2", | ||
"tslib": "^2.0.0" | ||
}, | ||
"description": "A module to create a set of unique numbers as fast as possible.", | ||
"devDependencies": { | ||
"@babel/core": "^7.10.2", | ||
"@babel/plugin-external-helpers": "^7.10.1", | ||
"@babel/plugin-transform-runtime": "^7.10.1", | ||
"@babel/preset-env": "^7.10.2", | ||
"@babel/register": "^7.10.1", | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/config-angular": "^8.3.4", | ||
"benchmark": "^2.1.4", | ||
"chai": "^4.2.0", | ||
"commitizen": "^4.1.2", | ||
"cz-conventional-changelog": "^3.2.0", | ||
"eslint": "^7.1.0", | ||
"eslint-config-holy-grail": "^47.0.1", | ||
"grunt": "^1.1.0", | ||
"grunt-babel": "^8.0.0", | ||
"grunt-cli": "^1.3.2", | ||
"grunt-contrib-clean": "^2.0.0", | ||
"grunt-sh": "^0.2.0", | ||
"husky": "^4.2.5", | ||
"karma": "^5.0.9", | ||
"karma-browserstack-launcher": "^1.6.0", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-firefox-launcher": "^1.3.0", | ||
"karma-mocha": "^2.0.1", | ||
"karma-opera-launcher": "^1.0.0", | ||
"karma-safari-launcher": "^1.0.0", | ||
"karma-sauce-launcher": "^4.1.5", | ||
"karma-sinon-chai": "^2.0.2", | ||
"karma-webpack": "^4.0.2", | ||
"load-grunt-config": "^3.0.1", | ||
"mocha": "^7.2.0", | ||
"rollup": "^2.13.1", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"sinon": "^9.0.2", | ||
"sinon-chai": "^3.5.0", | ||
"ts-loader": "^7.0.5", | ||
"tsconfig-holy-grail": "^11.0.14", | ||
"tslint": "^6.1.2", | ||
"tslint-config-holy-grail": "^50.0.1", | ||
"typescript": "^3.9.5", | ||
"webpack": "^4.43.0" | ||
}, | ||
"engines": { | ||
"node": ">=10.15.3" | ||
}, | ||
"files": [ | ||
"build/es2019/", | ||
"build/es5/", | ||
"build/node/", | ||
"src/" | ||
], | ||
"homepage": "https://github.com/chrisguttandin/fast-unique-numbers", | ||
"husky": { | ||
"hooks": { | ||
"commit-msg": "commitlint --edit --extends @commitlint/config-angular", | ||
"pre-commit": "grunt lint" | ||
} | ||
}, | ||
"keywords": [ | ||
"performance", | ||
"speed" | ||
], | ||
"license": "MIT", | ||
"main": "build/node/module.js", | ||
"module": "build/es2019/module.js", | ||
"name": "fast-unique-numbers", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/chrisguttandin/fast-unique-numbers.git" | ||
}, | ||
"scripts": { | ||
"prepublishOnly": "grunt build", | ||
"test": "grunt lint && grunt test" | ||
}, | ||
"types": "build/es2019/module.d.ts", | ||
"version": "5.0.10" | ||
"author": "Christoph Guttandin", | ||
"browser": "build/es5/bundle.js", | ||
"bugs": { | ||
"url": "https://github.com/chrisguttandin/fast-unique-numbers/issues" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "cz-conventional-changelog" | ||
} | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.10.2", | ||
"tslib": "^2.0.0" | ||
}, | ||
"description": "A module to create a set of unique numbers as fast as possible.", | ||
"devDependencies": { | ||
"@babel/core": "^7.10.2", | ||
"@babel/plugin-external-helpers": "^7.10.1", | ||
"@babel/plugin-transform-runtime": "^7.10.1", | ||
"@babel/preset-env": "^7.10.2", | ||
"@babel/register": "^7.10.1", | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/config-angular": "^8.3.4", | ||
"benchmark": "^2.1.4", | ||
"chai": "^4.2.0", | ||
"commitizen": "^4.1.2", | ||
"cz-conventional-changelog": "^3.2.0", | ||
"eslint": "^7.2.0", | ||
"eslint-config-holy-grail": "^47.0.4", | ||
"grunt": "^1.1.0", | ||
"grunt-babel": "^8.0.0", | ||
"grunt-cli": "^1.3.2", | ||
"grunt-contrib-clean": "^2.0.0", | ||
"grunt-sh": "^0.2.0", | ||
"husky": "^4.2.5", | ||
"karma": "^5.1.0", | ||
"karma-browserstack-launcher": "^1.6.0", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-firefox-launcher": "^1.3.0", | ||
"karma-mocha": "^2.0.1", | ||
"karma-opera-launcher": "^1.0.0", | ||
"karma-safari-launcher": "^1.0.0", | ||
"karma-sauce-launcher": "^4.1.5", | ||
"karma-sinon-chai": "^2.0.2", | ||
"karma-webpack": "^4.0.2", | ||
"load-grunt-config": "^3.0.1", | ||
"mocha": "^8.0.1", | ||
"prettier": "^2.0.5", | ||
"pretty-quick": "^2.0.1", | ||
"rollup": "^2.17.0", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"sinon": "^9.0.2", | ||
"sinon-chai": "^3.5.0", | ||
"ts-loader": "^7.0.5", | ||
"tsconfig-holy-grail": "^11.0.16", | ||
"tslint": "^6.1.2", | ||
"tslint-config-holy-grail": "^50.0.4", | ||
"typescript": "^3.9.5", | ||
"webpack": "^4.43.0" | ||
}, | ||
"engines": { | ||
"node": ">=10.15.3" | ||
}, | ||
"files": [ | ||
"build/es2019/", | ||
"build/es5/", | ||
"build/node/", | ||
"src/" | ||
], | ||
"homepage": "https://github.com/chrisguttandin/fast-unique-numbers", | ||
"husky": { | ||
"hooks": { | ||
"commit-msg": "commitlint --edit --extends @commitlint/config-angular", | ||
"pre-commit": "pretty-quick --config config/prettier/config.json --staged && grunt lint" | ||
} | ||
}, | ||
"keywords": [ | ||
"performance", | ||
"speed" | ||
], | ||
"license": "MIT", | ||
"main": "build/node/module.js", | ||
"module": "build/es2019/module.js", | ||
"name": "fast-unique-numbers", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/chrisguttandin/fast-unique-numbers.git" | ||
}, | ||
"scripts": { | ||
"prepublishOnly": "grunt build", | ||
"test": "grunt lint && grunt test" | ||
}, | ||
"types": "build/es2019/module.d.ts", | ||
"version": "5.0.11" | ||
} |
@@ -7,3 +7,3 @@ import { TGenerateUniqueNumberFactory } from '../types'; | ||
*/ | ||
const MAX_SAFE_INTEGER = (Number.MAX_SAFE_INTEGER === undefined) ? 9007199254740991 : Number.MAX_SAFE_INTEGER; | ||
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER === undefined ? 9007199254740991 : Number.MAX_SAFE_INTEGER; | ||
const TWO_TO_THE_POWER_OF_TWENTY_NINE = 536870912; | ||
@@ -24,7 +24,3 @@ const TWO_TO_THE_POWER_OF_THIRTY = TWO_TO_THE_POWER_OF_TWENTY_NINE * 2; | ||
*/ | ||
let nextNumber = (lastNumber === undefined) | ||
? collection.size | ||
: (lastNumber < TWO_TO_THE_POWER_OF_THIRTY) | ||
? lastNumber + 1 | ||
: 0; | ||
let nextNumber = lastNumber === undefined ? collection.size : lastNumber < TWO_TO_THE_POWER_OF_THIRTY ? lastNumber + 1 : 0; | ||
@@ -31,0 +27,0 @@ if (!collection.has(nextNumber)) { |
{ | ||
"compilerOptions": { | ||
"isolatedModules": true | ||
}, | ||
"extends": "tsconfig-holy-grail/src/tsconfig-universal" | ||
"compilerOptions": { | ||
"isolatedModules": true | ||
}, | ||
"extends": "tsconfig-holy-grail/src/tsconfig-universal" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
35216
0.83%43
4.88%450
-1.75%