fast-ternary-string-set
Advanced tools
Comparing version 2.3.0 to 2.4.0
{ | ||
"name": "fast-ternary-string-set", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "", | ||
@@ -24,10 +24,12 @@ "keywords": [ | ||
"license": "MIT", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"main": "lib/cjs/fast-ternary-string-set.js", | ||
"module": "lib/esm/fast-ternary-string-set.js", | ||
"types": "lib/fast-ternary-string-set.d.ts", | ||
"unpkg": "lib/esm/fast-ternary-string-set.js", | ||
"scripts": { | ||
"build": "tsc && tsc --removeComments --declaration false", | ||
"build": "tsc --removeComments --declaration false && tsc -p tsconfig-cjs.json --removeComments --declaration false && tsc --emitDeclarationOnly --outDir lib", | ||
"test": "jest --config jestconfig.json", | ||
"format": "prettier --write \"src/**/*.ts\"", | ||
"lint": "eslint src", | ||
"doc": "typedoc --excludePrivate src/index.ts --out docs", | ||
"doc": "typedoc --excludePrivate src/fast-ternary-string-set.ts --out docs", | ||
"prepare": "npm run build", | ||
@@ -34,0 +36,0 @@ "prepublishOnly": "npm run lint && npm test", |
@@ -40,2 +40,3 @@ # Fast ternary string set | ||
To use the library in a Node.js project, you must first install it. | ||
To install the latest stable version with `npm`: | ||
@@ -53,3 +54,3 @@ | ||
To use it without Node.js, you can simply copy the main source file (`src/index.ts`) into any TypeScript project, rename to something sensible, and then `import` it into your code as usual. | ||
You can also use the library without Node.js. In a TypeScript project, simply copy the main source file (`src/fast-ternary-string-set.ts`) into your project and then `import` it as usual. To use it on a Web page as an ES6 module without using Node.js, see the first example immediately below. | ||
@@ -63,6 +64,14 @@ ## Examples | ||
```js | ||
// From a Web page with ES6 modules: | ||
import { TernaryStringSet } from "https://unpkg.com/fast-ternary-string-set"; | ||
// From Node.js with ES6 modules: | ||
import { TernaryStringSet } from "fast-ternary-string-set"; | ||
// From Node.js with CommonJS-style modules: | ||
const { TernaryStringSet } = require("fast-ternary-string-set"); | ||
// From TypeScript: | ||
// From TypeScript + Node.js: | ||
import { TernaryStringSet } from "fast-ternary-string-set"; | ||
// From TypeScript standalone | ||
import { TernaryStringSet } from "./path/to/fast-ternary-string-set"; | ||
``` | ||
@@ -212,3 +221,3 @@ | ||
A simple spelling checker: | ||
A simple spelling checker (uses Node.js `fs` module): | ||
@@ -263,3 +272,3 @@ ```js | ||
- Methods that would return a new `Set`, such as `filter` or `union`, return a new `TernaryStringSet`. | ||
- Methods expect that `this` to be a `TernaryStringSet`; they should not be `call`ed with arbitrary objects. | ||
- Methods expect `this` to be a `TernaryStringSet`; they should not be `call`ed with arbitrary objects. | ||
- The `addAll` method accepts either a list of string arguments (like `Set`s), or an `Iterable<string>` with an optional range. | ||
@@ -330,4 +339,5 @@ | ||
The included `tsconfig.json` targets ES2020. | ||
To target old JavaScript engines or browsers you will need to modify this configuration and/or use a tool like Babel. | ||
This will compile both CommonJS and ES6 versions of the module. | ||
The CommonJS version targets ES2015, while the ES6 version targets the latest JS standards. | ||
To target other JS engines or browsers, modify `tsconfig.json` and/or use a tool like [Babel](https://babeljs.io/). | ||
@@ -341,3 +351,3 @@ The project includes an extensive suite of tests under `src/tests`. | ||
HTML documentation can be prepared automatically using TypeDoc: | ||
[HTML documentation](https://cgjennings.github.io/fast-ternary-string-set/classes/TernaryStringSet.html) can be prepared automatically using TypeDoc: | ||
@@ -344,0 +354,0 @@ ```bash |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
149833
6
3430
488
1