Comparing version 2.0.2 to 2.0.3
@@ -1,18 +0,2 @@ | ||
/** | ||
* Quote a value. | ||
* | ||
* @param value | ||
* Value(s) to wrap in quotes | ||
* @param [open='"'] | ||
* Opening quote | ||
* @param [close=open] | ||
* Closing quote | ||
*/ | ||
export const quotation: { | ||
(value: string, open?: string | undefined, close?: string | undefined): string | ||
( | ||
value: string[], | ||
open?: string | undefined, | ||
close?: string | undefined | ||
): string[] | ||
} | ||
export function quotation(value: string, open?: string | null | undefined, close?: string | null | undefined): string; | ||
export function quotation(value: ReadonlyArray<string>, open?: string | null | undefined, close?: string | null | undefined): string[]; |
22
index.js
@@ -14,4 +14,4 @@ /** | ||
* @type {{ | ||
* (value: string, open?: string, close?: string): string | ||
* (value: string[], open?: string, close?: string): string[] | ||
* (value: string, open?: string | null | undefined, close?: string | null | undefined): string | ||
* (value: ReadonlyArray<string>, open?: string | null | undefined, close?: string | null | undefined): string[] | ||
* }} | ||
@@ -21,6 +21,6 @@ */ | ||
/** | ||
* @param {string|Array<string>} value | ||
* @param {string} open | ||
* @param {string} close | ||
* @returns {string|string[]} | ||
* @param {ReadonlyArray<string> | string} value | ||
* @param {string | null | undefined} open | ||
* @param {string | null | undefined} close | ||
* @returns {Array<string> | string} | ||
*/ | ||
@@ -30,9 +30,11 @@ function (value, open, close) { | ||
const end = close || start | ||
/** @type {string[]} */ | ||
const result = [] | ||
let index = -1 | ||
if (Array.isArray(value)) { | ||
while (++index < value.length) { | ||
result[index] = start + value[index] + end | ||
const list = /** @type {ReadonlyArray<string>} */ (value) | ||
/** @type {Array<string>} */ | ||
const result = [] | ||
while (++index < list.length) { | ||
result[index] = start + list[index] + end | ||
} | ||
@@ -39,0 +41,0 @@ |
{ | ||
"name": "quotation", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Quote a value", | ||
@@ -38,19 +38,17 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/tape": "^4.0.0", | ||
"c8": "^7.0.0", | ||
"prettier": "^2.0.0", | ||
"remark-cli": "^10.0.0", | ||
"@types/node": "^20.0.0", | ||
"c8": "^8.0.0", | ||
"prettier": "^3.0.0", | ||
"remark-cli": "^11.0.0", | ||
"remark-preset-wooorm": "^9.0.0", | ||
"rimraf": "^3.0.0", | ||
"tape": "^5.0.0", | ||
"type-coverage": "^2.0.0", | ||
"typescript": "^4.0.0", | ||
"xo": "^0.46.0" | ||
"typescript": "^5.0.0", | ||
"xo": "^0.56.0" | ||
}, | ||
"scripts": { | ||
"prepublishOnly": "npm run build && npm run format", | ||
"build": "rimraf \"*.d.ts\" && tsc && type-coverage", | ||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", | ||
"prepack": "npm run build && npm run format", | ||
"build": "tsc --build --clean && tsc --build && type-coverage", | ||
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", | ||
"test-api": "node --conditions development test.js", | ||
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api", | ||
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api", | ||
"test": "npm run build && npm run format && npm run test-coverage" | ||
@@ -57,0 +55,0 @@ }, |
@@ -36,3 +36,3 @@ # quotation | ||
This package is [ESM only][esm]. | ||
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: | ||
In Node.js (version 14.14+, 16.0+), install with [npm][]: | ||
@@ -43,13 +43,13 @@ ```sh | ||
In Deno with [Skypack][]: | ||
In Deno with [`esm.sh`][esmsh]: | ||
```js | ||
import {quotation} from 'https://cdn.skypack.dev/quotation@2?dts' | ||
import {quotation} from 'https://esm.sh/quotation@2' | ||
``` | ||
In browsers with [Skypack][]: | ||
In browsers with [`esm.sh`][esmsh]: | ||
```html | ||
<script type="module"> | ||
import {quotation} from 'https://cdn.skypack.dev/quotation@2?min' | ||
import {quotation} from 'https://esm.sh/quotation@2?bundle' | ||
</script> | ||
@@ -71,3 +71,3 @@ ``` | ||
This package exports the following identifier: `quotation`. | ||
This package exports the identifier `quotation`. | ||
There is no default export. | ||
@@ -91,3 +91,3 @@ | ||
This package is fully typed with [TypeScript][]. | ||
There are no extra exported types. | ||
It exports no additional types. | ||
@@ -97,3 +97,3 @@ ## Compatibility | ||
This package is at least compatible with all maintained versions of Node.js. | ||
As of now, that is Node.js 12.20+, 14.14+, and 16.0+. | ||
As of now, that is Node.js 14.14+ and 16.0+. | ||
It also works in Deno and modern browsers. | ||
@@ -134,3 +134,3 @@ | ||
[skypack]: https://www.skypack.dev | ||
[esmsh]: https://esm.sh | ||
@@ -137,0 +137,0 @@ [license]: license |
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
8
7414
45