Skip to content

Commit 6aba20e

Browse files
Merge branch 'master' into init-files
2 parents 2302b10 + 895f9a2 commit 6aba20e

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,29 @@
1-
# node.js-byte-flag-calculator
2-
byte flag calculator for javascript
1+
# node.js-bytes-calculator
2+
abstract and easy way how to work with bytes in JS
3+
4+
## software requirements
5+
* node.js v6.9+ [with v8 enabled]
6+
* npm v3+
7+
8+
## used technologies
9+
* jest
10+
11+
## how to execute tests
12+
`npm test`
13+
to execute tests with coverage
14+
`npm test -- --coverage`
15+
16+
## how to use
17+
`import calc from "node-bytes-calculator";` or `const calc = require("node-bytes-calculator");`
18+
19+
```
20+
calc.hasBytes(0xff, 0x0f) -> return true as 0xff contains 0x0f bytes
21+
calc.hasBytes(0x02, 0x08) -> retuns false as 0x02 do not contains 0x08 bytes
22+
23+
calc.addBytes(0x02, 0x02) -> returns 0x02
24+
calc.addBytes(0x01, 0x02) -> returns 0x03
25+
26+
calc.removeBytes(0x00, 0x01) -> returns 0x00 as there where no bytes
27+
calc.removeBytes(0x06, 0x02) -> returns 0x04 as 0x02 bytes been delete removed from 0x06
28+
calc.removeBytes(0x02, 0x06) -> returns 0x02 as 0x06 bytes wasn't presented in 0x02
29+
```

0 commit comments

Comments
 (0)