Skip to content

Commit

Permalink
Add husky and checks #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Santeri committed Aug 30, 2020
1 parent 798ad0d commit 0421483
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
lib
README.md

196 changes: 196 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@
"devDependencies": {
"@types/node": "^14.6.2",
"chai": "^4.2.0",
"husky": "^4.2.5",
"mocha": "^8.1.3",
"prettier": "^2.1.1",
"rewire": "^5.0.0",
"typescript": "^4.0.2"
},
"husky": {
"hooks": {
"pre-commit": "npm run lint",
"pre-push": "npm run test"
}
}
}
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,13 @@ const hilbert_curve = (precision: number, bits_per_char = 6) => {
};
};

const isOverflowing = (bits: number) => assert(bits < 64, "Over 64 bits not supported. Reduce 'precision' or 'bits_per_char' so their product is <= 64");
const isCorrectBpc = (bpc: number) => assert(bpc in [2, 4, 6], "bits_per_char must be 2, 4 or 6");
const isOverflowing = (bits: number) =>
assert(
bits < 64,
"Over 64 bits not supported. Reduce 'precision' or 'bits_per_char' so their product is <= 64"
);
const isCorrectBpc = (bpc: number) =>
assert([2, 4, 6].includes(bpc), "bits_per_char must be 2, 4 or 6");

const encode = (
lng: number,
Expand Down

0 comments on commit 0421483

Please sign in to comment.