Skip to content

Commit

Permalink
Added example, fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kormanowsky committed Aug 16, 2020
1 parent 4e51813 commit 03e7b9a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* js-bit-list working example
* @author Mikhail Kormanowsky
*/

const BitList = require("./index");

const MyBitList = BitList.useKeys(["myKey", "otherKey"]);

let myBitListInstance = new MyBitList({myKey: true});

console.log("It works!");
console.log("Number", myBitListInstance.toNumber());
console.log("myKey value", myBitListInstance.toObject().myKey);
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class BitList {
super(initialValue);
} catch (error) {
if (typeof initialValue === "object" && initialValue !== null) {
super(0);
this.setObject(initialValue);
} else {
throw error;
Expand Down

0 comments on commit 03e7b9a

Please sign in to comment.