fast-boolean-array 1.4.5 → 1.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Fast Boolean Array
1
+ # Fast Boolean Array ![Build](https://github.com/UltraCakeBakery/FastBooleanArray/actions/workflows/ci.yml/badge.svg?event=push)
2
2
 
3
3
  In JavaScript, when working with large arrays of boolean values, a common challenge is efficiently indexing and retrieving these values. Using a regular JavaScript array to store booleans is straightforward, but it is memory-inefficient. While booleans are conceptually 1-bit values, JavaScript engines, like V8 (in Chrome and Node.js), allocate 1 byte (8 bits) per boolean for optimization purposes. This can waste a significant amount of memory when dealing with large arrays.
4
4
 
@@ -8,53 +8,47 @@ For detailed benchmark results, see below.
8
8
 
9
9
  ## Features
10
10
 
11
-
12
11
  - **Memory Efficiency**: Stores booleans in bits rather than bytes, drastically reducing memory usage.
13
12
  - **Fast Set Performance**: Up to 10x faster sets for fast data re-mapping.
14
- - **Familiar API**: `Map` and `Set` like API for minimal learning curve. Intuitive helper functions, and works in `for.. of`.
15
- - **Array like interface**: call `.accessLikeArray()` to access it like an array`someArray[index]` (beware of the performance penalty caused by the Proxy)!
16
- ---
17
-
18
- ## Why Use Fast Boolean Array?
13
+ - **Familiar API**: `Map` and `Set` like API for minimal learning curve. Intuitive helper functions, and works in `for.. of`.
14
+ - **Array like interface**: call `.accessLikeArray()` to access it like an array`someArray[index]` (beware of the performance penalty caused by the Proxy)!
19
15
 
20
- - **Easy to Use**: Familiar `Map` and `Set` like API for minimal learning curve.
21
- - **Scalable**: Suitable for high-performance, memory-sensitive projects.
22
16
  ---
23
17
 
24
- ## Installation
25
-
26
- Install the package via npm:
27
-
28
- ```bash
29
- npm install fast-boolean-array --save-dev
30
- pnpm install fast-boolean-array --save-dev
31
- ```
32
-
33
- ---
34
-
35
- ## Usage
18
+ ## Usage example:
36
19
 
37
20
  Here's how to use the Fast Boolean Array:
38
21
 
39
22
  ```javascript
40
- import BooleanArray from 'fast-boolean-array';
23
+ import BooleanArray from "fast-boolean-array";
41
24
  // const BooleanArray = require('fast-boolean-array'); commonjs works too.
42
25
 
43
- // Create a new BooleanArray with the desired size
26
+ // Create a new BooleanArray with the desired length
44
27
  const booleans = new BooleanArray(2);
45
28
 
46
29
  // Set a value at a specific index
47
30
  booleans.set(0, true);
48
31
  booleans.set(1, false);
49
32
 
50
- // Retrieve it
33
+ // Retrieve a value at a specific index
51
34
  console.log(booleans.get(0)); // Output: true
52
35
  console.log(booleans.get(1)); // Output: false
53
36
 
54
37
  booleans.set(3, true); // will not throw, but returns false as the boolean is not found
55
38
  console.log(booleans.get(3)); // Output: false
56
39
 
57
- booleans.setSafe(3, true); // will throw RangeError
40
+ booleans.setSafe(3, true); // will throw RangeError because the array has a length of 2
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Installation
46
+
47
+ Install the package:
48
+
49
+ ```bash
50
+ npm install fast-boolean-array
51
+ pnpm install fast-boolean-array
58
52
  ```
59
53
 
60
54
  ---
package/package.json CHANGED
@@ -1,53 +1,52 @@
1
- {
2
- "name": "fast-boolean-array",
3
- "version": "1.4.5",
4
- "homepage": "https://github.com/UltraCakeBakery/FastBooleanArray",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/UltraCakeBakery/FastBooleanArray.git"
8
- },
9
- "bugs": {
10
- "url": "https://github.com/UltraCakeBakery/FastBooleanArray/issues",
11
- "email": "fast-boolean-array@managing.software"
12
- },
13
- "type": "module",
14
- "main": "./dist/index.cjs",
15
- "module": "./dist/index.js",
16
- "types": "./dist/index.d.ts",
17
- "exports": {
18
- "import": {
19
- "types": "./dist/index.d.ts",
20
- "import": "./dist/index.js"
21
- },
22
- "require": {
23
- "types": "./dist/index.d.cts",
24
- "require": "./dist/index.cjs"
25
- }
26
- },
27
- "scripts": {
28
- "check": "npm run check:types ; npm run check:test",
29
- "check:test": "vitest",
30
- "check:types": "npx --yes @arethetypeswrong/cli --pack .",
31
- "build": "tsup src/index.ts --dts --format cjs,esm --clean --sourcemap --minify",
32
- "publish": "npm publish"
33
- },
34
- "keywords": [
35
- "boolean",
36
- "array",
37
- "fast",
38
- "efficient",
39
- "map"
40
- ],
41
- "author": "Jack van der Bil <jack@managing.software> (https://jackvanderbilt.nl)",
42
- "license": "MIT",
43
- "description": "",
44
- "engines": {
45
- "node": ">=0.10.3"
46
- },
47
- "devDependencies": {
48
- "@types/node": "^22.10.2",
49
- "tsup": "^8.3.5",
50
- "typescript": "^5.7.2",
51
- "vitest": "^2.1.8"
52
- }
1
+ {
2
+ "name": "fast-boolean-array",
3
+ "version": "1.4.7",
4
+ "homepage": "https://github.com/UltraCakeBakery/FastBooleanArray",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/UltraCakeBakery/FastBooleanArray.git"
8
+ },
9
+ "bugs": {
10
+ "url": "https://github.com/UltraCakeBakery/FastBooleanArray/issues",
11
+ "email": "fast-boolean-array@managing.software"
12
+ },
13
+ "type": "module",
14
+ "main": "./dist/index.cjs",
15
+ "module": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ "import": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ },
22
+ "require": {
23
+ "types": "./dist/index.d.cts",
24
+ "require": "./dist/index.cjs"
25
+ }
26
+ },
27
+ "scripts": {
28
+ "test": "vitest",
29
+ "check-types": "npx --yes @arethetypeswrong/cli --pack .",
30
+ "build": "tsup src/index.ts --dts --format cjs,esm --clean --sourcemap --minify",
31
+ "publish": "npm publish"
32
+ },
33
+ "keywords": [
34
+ "boolean",
35
+ "array",
36
+ "fast",
37
+ "efficient",
38
+ "map"
39
+ ],
40
+ "author": "Jack van der Bil <jack@managing.software> (https://jackvanderbilt.nl)",
41
+ "license": "MIT",
42
+ "description": "",
43
+ "engines": {
44
+ "node": ">=0.10.3"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^22.10.7",
48
+ "tsup": "^8.3.5",
49
+ "typescript": "^5.7.3",
50
+ "vitest": "^3.0.2"
51
+ }
53
52
  }
@@ -1,11 +0,0 @@
1
- # To get started with Dependabot version updates, you'll need to specify which
2
- # package ecosystems to update and where the package manifests are located.
3
- # Please see the documentation for all configuration options:
4
- # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
-
6
- version: 2
7
- updates:
8
- - package-ecosystem: "npm" # See documentation for possible values
9
- directory: "/" # Location of package manifests
10
- schedule:
11
- interval: "weekly"