Skip to content

Commit 03e7b9a

Browse files
committed
Added example, fixed bug
1 parent 4e51813 commit 03e7b9a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

example.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* js-bit-list working example
3+
* @author Mikhail Kormanowsky
4+
*/
5+
6+
const BitList = require("./index");
7+
8+
const MyBitList = BitList.useKeys(["myKey", "otherKey"]);
9+
10+
let myBitListInstance = new MyBitList({myKey: true});
11+
12+
console.log("It works!");
13+
console.log("Number", myBitListInstance.toNumber());
14+
console.log("myKey value", myBitListInstance.toObject().myKey);

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ class BitList {
195195
super(initialValue);
196196
} catch (error) {
197197
if (typeof initialValue === "object" && initialValue !== null) {
198+
super(0);
198199
this.setObject(initialValue);
199200
} else {
200201
throw error;

0 commit comments

Comments
 (0)