Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wbhob/node-binary
An encoder and decoder of binary numbers in Node
https://github.com/wbhob/node-binary
Last synced: about 2 months ago
JSON representation
An encoder and decoder of binary numbers in Node
- Host: GitHub
- URL: https://github.com/wbhob/node-binary
- Owner: wbhob
- License: mit
- Created: 2019-04-24T18:12:53.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T20:18:51.000Z (about 2 years ago)
- Last Synced: 2024-10-15T19:45:22.203Z (4 months ago)
- Language: TypeScript
- Size: 795 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-binary
This project is a simple encoder/decoder of binary numbers. `encode()` returns a binary string, and `decode()` returns a native number. Limited by your JavaScript engine's `Number.MAX_VALUE` value, but may also yield inaccurate results for numbers greater than `Number.MAX_SAFE_INTEGER`.
## Usage
```typescript
import { encode, decode } from 'node-binary'encode(23) // returns '10111'
decode('10110') // returns '22'
```## Contributing
If you want to contribute, implement it in TypeScript in the `src/` directory. Add a test file in `__tests__/` to make sure it works properly – you can just copy one of the other testing files and substitute in your sorting algorithm.
## License
This project is licensed under the [MIT License](./LICENSE), so you're free to use it as you please with attribution and a link back to this project (though writing your own implementation would not be terribly difficult).
## Credits
Written by Wilson Hobbs, 2019.