Browse Source

Initial commit

master
Luke Childs 6 years ago
commit
78306e81bd
  1. 5
      .gitignore
  2. 8
      .travis.yml
  3. 21
      LICENSE
  4. 19
      README.md
  5. 35
      package.json
  6. 3
      src/index.js
  7. 6
      test/unit.js

5
.gitignore

@ -0,0 +1,5 @@
node_modules
.nyc_output
npm-debug.log
package-lock.json
yarn.lock

8
.travis.yml

@ -0,0 +1,8 @@
language: node_js
node_js:
- '8'
script: npm test
after_success: npm run coverage
notifications:
email:
on_success: never

21
LICENSE

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Luke Childs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

19
README.md

@ -0,0 +1,19 @@
# byte-range
> Returns integer ranges for C data types
[![Build Status](https://travis-ci.com/lukechilds/byte-range.svg?branch=master)](https://travis-ci.com/lukechilds/byte-range)
[![Coverage Status](https://coveralls.io/repos/github/lukechilds/byte-range/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/byte-range?branch=master)
[![npm](https://img.shields.io/npm/v/byte-range.svg)](https://www.npmjs.com/package/byte-range)
Returns the integer range for a given number of bytes or C data types. This is useful for validating values when dealing with low level protocols or interfacing with other low level languages.
## Install
```shell
npm install byte-range
```
## License
MIT © Luke Childs

35
package.json

@ -0,0 +1,35 @@
{
"name": "byte-range",
"version": "0.0.0",
"description": "Returns integer ranges for C data types",
"main": "src/index.js",
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && nyc ava",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"repository": {
"type": "git",
"url": "git+https://github.com/lukechilds/byte-range.git"
},
"keywords": [
"integer",
"byte",
"c",
"range"
],
"author": "Luke Childs <lukechilds123@gmail.com> (http://lukechilds.co.uk)",
"license": "MIT",
"bugs": {
"url": "https://github.com/lukechilds/byte-range/issues"
},
"homepage": "https://github.com/lukechilds/byte-range#readme",
"devDependencies": {
"ava": "^0.25.0",
"coveralls": "^3.0.2",
"nyc": "^13.1.0",
"xo": "^0.23.0"
}
}

3
src/index.js

@ -0,0 +1,3 @@
const byteRange = bytes => [0, Math.pow(2, (bytes * 8)) - 1];
module.exports = byteRange;

6
test/unit.js

@ -0,0 +1,6 @@
import test from 'ava';
import byteRange from '..';
test('byteRange is exported', t => {
t.not(byteRange, undefined);
});
Loading…
Cancel
Save