All Projects → lukechilds → Byte Range

lukechilds / Byte Range

Licence: mit
Returns integer ranges for C data types

Programming Languages

javascript
184084 projects - #8 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Byte Range

Cti Stix Validator
OASIS TC Open Repository: Validator for STIX 2.0 JSON normative requirements and best practices
Stars: ✭ 24 (-20%)
Mutual labels:  validation
Ember I18n Changeset Validations
ember-i18n support for ember-changeset-validations messages
Stars: ✭ 11 (-63.33%)
Mutual labels:  validation
Cymbology
Identifies and validates financial security ids such as Sedol, Cusip, Isin numbers.
Stars: ✭ 13 (-56.67%)
Mutual labels:  validation
Valley
Extensible schema validations and declarative syntax helpers in Python.
Stars: ✭ 25 (-16.67%)
Mutual labels:  validation
Egg Valid
👮Validation plugin for eggjs
Stars: ✭ 10 (-66.67%)
Mutual labels:  validation
In App Purchase
A Node.js module for in-App-Purchase for iOS, Android, Amazon and Windows.
Stars: ✭ 868 (+2793.33%)
Mutual labels:  validation
Govalid
Struct validation using tags
Stars: ✭ 22 (-26.67%)
Mutual labels:  validation
Swagger2
Loading, parsing and validating requests to HTTP services based on Swagger v2.0 documents
Stars: ✭ 20 (-33.33%)
Mutual labels:  validation
Structured Acceptance Test
An open format definition for static analysis tools
Stars: ✭ 10 (-66.67%)
Mutual labels:  validation
Sequelize Joi
Joi schema validation for Sequelize models
Stars: ✭ 13 (-56.67%)
Mutual labels:  validation
Trumail
✉️ ✅ A Fast and Free Email Verification API written in Go
Stars: ✭ 937 (+3023.33%)
Mutual labels:  validation
Ismailfine
A simple (but correct) library for validating email addresses. Supports mail addresses as defined in rfc5322 as well as the new Internationalized Mail Address standards (rfc653x). Based on https://github.com/jstedfast/EmailValidation
Stars: ✭ 9 (-70%)
Mutual labels:  validation
Kubevious
Kubevious - application centric Kubernetes UI and continuous assurance provider
Stars: ✭ 869 (+2796.67%)
Mutual labels:  validation
Grpc Dotnet Validator
Simple request message validator for grpc.aspnet
Stars: ✭ 25 (-16.67%)
Mutual labels:  validation
Typet
Types that make coding in Python quick and safe.
Stars: ✭ 15 (-50%)
Mutual labels:  validation
Cafy
☕️ Simple, lightweight, flexible validator generator
Stars: ✭ 22 (-26.67%)
Mutual labels:  validation
Openapi3 Validator
Validator for OpenAPI v3 specs
Stars: ✭ 11 (-63.33%)
Mutual labels:  validation
Quiver
Validation, searching and filtering made easy for swift.
Stars: ✭ 27 (-10%)
Mutual labels:  validation
Joi Json
Builds Joi schemas from JSON
Stars: ✭ 15 (-50%)
Mutual labels:  validation
Mintype
🍵 minimal composable type abstraction
Stars: ✭ 12 (-60%)
Mutual labels:  validation

byte-range

Returns integer ranges for a given number of bytes.

Build Status Coverage Status npm

Returns the integer range for a given number of bytes or a C data type. This is useful for validating values when dealing with low-level protocols or interfacing with other low-level languages.

Install

npm install byte-range

Usage

Check the integer range for a given number of bytes:

const byteRange = require('byte-range');

byteRange(1);
// [0, 255]
byteRange(2);
// [0, 65535]

You can check signed or unsigned integer ranges:

byteRange(1, {signed: false});
// [0, 255]
byteRange(1, {signed: true});
// [-128, 127]

There are also some common C data types precomputed:

byteRange.uint8;
// [0, 255]
byteRange.uint16;
// [0, 65535]
byteRange.uint32;
// [0, 4294967295]
byteRange.int8;
// [-128, 127]
byteRange.int16;
// [-32768, 32767]
byteRange.int32;
// [-2147483648, 2147483647]

API

byteRange(bytes, [options])

Returns integer ranges for a given number of bytes.

bytes

Type: number
Default: undefined

Number of bytes to return the integer range for. Must be a positive integer.

options

Type: Object
Default: {signed: false}

An object containing the following properties:

signed

Type: boolean
Default: false

A boolean indicating whether the integer range is signed.

byteRange.uint8

Precomputed byte range for an unsigned 8 bit integer.

byteRange.uint16

Precomputed byte range for an unsigned 16 bit integer.

byteRange.uint32

Precomputed byte range for an unsigned 32 bit integer.

byteRange.int8

Precomputed byte range for a signed 8 bit integer.

byteRange.int16

Precomputed byte range for a signed 16 bit integer.

byteRange.int32

Precomputed byte range for a signed 32 bit integer.

License

MIT © Luke Childs

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].