Skip to content

Commit 5daa1b1

Browse files
committed
Cleaning the examples
1 parent ce9f108 commit 5daa1b1

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

FastIntegerCompression.js

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,13 @@
66
*FastIntegerCompression
77
* Simple usage :
88
* // var FastIntegerCompression = require("fastintcompression");// if you use node
9-
* var b = new FastBitSet();// initially empty
10-
* b.add(1);// add the value "1"
11-
* b.has(1); // check that the value is present! (will return true)
12-
* b.add(2);
13-
* console.log(""+b);// should display {1,2}
14-
* b.add(10);
15-
* b.array(); // would return [1,2,10]
9+
* var array = [10,100000,65999,10,10,0,1,1,2000];
10+
* var buf = FastIntegerCompression.compress(array);
11+
* var back = FastIntegerCompression.uncompress(buf); // gets back [10,100000,65999,10,10,0,1,1,2000]
1612
*
17-
* var c = new FastBitSet([1,2,3,10]); // create bitset initialized with values 1,2,3,10
18-
* c.difference(b); // from c, remove elements that are in b
19-
* var su = c.union_size(b);// compute the size of the union (bitsets are unchanged)
20-
* c.union(b); // c will contain all elements that are in c and b
21-
* var s1 = c.intersection_size(b);// compute the size of the intersection (bitsets are unchanged)
22-
* c.intersection(b); // c will only contain elements that are in both c and b
23-
* c = b.clone(); // create a (deep) copy of b and assign it to c.
24-
* c.equals(b); // check whether c and b are equal
25-
*
26-
* See README.md file for a more complete description.
2713
*
2814
* You can install the library under node with the command line
29-
* npm install fastbitset
15+
* npm install fastintcompression
3016
*/
3117
'use strict';
3218

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
# FastIntegerCompression
2+
23
This is an integer compression library in JavaScript, useful for work on indexes.
4+
Given an array of integers, it produces an ArrayBuffer that uses far fewer bytes
5+
than the original. You can later recover the original array quickly.
6+
7+
8+
```javascript
9+
// var FastIntegerCompression = require("fastintcompression");// if you use node
10+
var array = [10,100000,65999,10,10,0,1,1,2000];
11+
var buf = FastIntegerCompression.compress(array);
12+
var back = FastIntegerCompression.uncompress(buf); // gets back [10,100000,65999,10,10,0,1,1,2000]
13+
```
314

4-
Status: highly experimental.
15+
You can install the library under node with the command line
16+
```bash
17+
npm install fastintcompression
18+
```

0 commit comments

Comments
 (0)