is-name-taken
Advanced tools
Comparing version 1.1.1 to 2.0.0
@@ -1,2 +0,3 @@ | ||
export declare type Options = { | ||
import { LoadOptions } from "all-package-names"; | ||
export declare type Options = LoadOptions & { | ||
/** | ||
@@ -3,0 +4,0 @@ * Setting optimistic to true will skip syncing latest packages from NPM. |
@@ -23,2 +23,10 @@ "use strict"; | ||
function getSave(options) { | ||
if (options != null && options.optimistic) { | ||
return (0, _allPackageNames.load)(options); | ||
} else { | ||
return (0, _allPackageNames.sync)(options); | ||
} | ||
} | ||
function isTaken(_x, _x2) { | ||
@@ -31,3 +39,3 @@ return _isTaken.apply(this, arguments); | ||
if (isValid(name)) { | ||
return (options != null && options.optimistic ? _allPackageNames.load : _allPackageNames.sync)().then(function (_ref) { | ||
return getSave(options).then(function (_ref) { | ||
var packageNames = _ref.packageNames; | ||
@@ -34,0 +42,0 @@ return (0, _packageNameConflict.conflictsAny)(name, packageNames); |
@@ -0,1 +1,15 @@ | ||
# [2.0.0](https://github.com/bconnorwhite/is-name-taken/compare/v1.1.1...v2.0.0) (2021-04-08) | ||
### Features | ||
* add maxAge flag, improve caching ([9c4058a](https://github.com/bconnorwhite/is-name-taken/commit/9c4058ac3868ea53f08a3846e448b731ae747b08)) | ||
### BREAKING CHANGES | ||
* replaced timeout flag with maxAge | ||
## [1.1.1](https://github.com/bconnorwhite/is-name-taken/compare/v1.1.0...v1.1.1) (2021-04-05) | ||
@@ -2,0 +16,0 @@ |
{ | ||
"name": "is-name-taken", | ||
"version": "1.1.1", | ||
"version": "2.0.0", | ||
"description": "Check if an NPM package name is taken", | ||
@@ -38,4 +38,2 @@ "license": "MIT", | ||
"lint": "bob lint", | ||
"postversion": "git push", | ||
"prepublishOnly": "yarn build && yarn test", | ||
"release": "bob publish", | ||
@@ -45,4 +43,4 @@ "test": "bob test" | ||
"dependencies": { | ||
"all-package-names": "^1.0.17", | ||
"package-name-conflict": "^1.0.1", | ||
"all-package-names": "^2.0.2", | ||
"package-name-conflict": "^1.0.3", | ||
"validate-npm-package-name": "^3.0.0" | ||
@@ -57,2 +55,7 @@ }, | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"commit-msg": "bob lint commit" | ||
} | ||
}, | ||
"npmpackagejsonlint": { | ||
@@ -59,0 +62,0 @@ "extends": "npm-package-json-lint-config-bob" |
@@ -64,13 +64,17 @@ <div align="center"> | ||
isTaken(name: string, options?: Options) => Promise<boolean | string>; | ||
isValid(name: string) => boolean; | ||
type Options = { | ||
/** | ||
* Maximum milliseconds after a sync to avoid re-syncing | ||
*/ | ||
maxAge?: number; | ||
/** | ||
* Setting optimistic to true will skip syncing latest packages from NPM. | ||
* This is faster, but may lead to inconsistencies with recently published packages. | ||
*/ | ||
*/ | ||
optimistic?: boolean; | ||
}; | ||
function isValid(name: string): boolean; | ||
function isTaken(name: string, options?: Options): Promise<string | boolean>; | ||
``` | ||
@@ -84,3 +88,3 @@ | ||
- [all-package-names](https://npmjs.com/package/all-package-names): Get all NPM package names. | ||
- [all-package-names](https://npmjs.com/package/all-package-names): Get all NPM package names | ||
- [package-name-conflict](https://npmjs.com/package/package-name-conflict): Check if NPM package names conflict | ||
@@ -87,0 +91,0 @@ - [validate-npm-package-name](https://npmjs.com/package/validate-npm-package-name): Give me a string and I'll tell you if it's a valid npm package name |
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
8175
46
118
+ Addedall-package-names@2.0.897(transitive)
+ Addedp-lock@2.1.0(transitive)
- Removedall-package-names@1.1.2(transitive)
- Removedchar-to-string@1.0.0(transitive)
- Removeddetect-newline@3.1.0(transitive)
- Removedends-with-string@1.0.1(transitive)
- Removedfile-exists-safe@1.1.0(transitive)
- Removedread-json-safe@2.0.2(transitive)
- Removedremove-file-safe@1.0.1(transitive)
- Removedstringify-json-object@1.0.7(transitive)
- Removedterminating-newline@1.2.4(transitive)
- Removedwrite-dir-safe@1.0.1(transitive)
- Removedwrite-file-safe@1.3.1(transitive)
- Removedwrite-json-safe@2.1.0(transitive)
Updatedall-package-names@^2.0.2
Updatedpackage-name-conflict@^1.0.3