Passed
Push — master ( 8ff0a1...a2cde2 )
by Rafael S.
01:21
created

index.js   A

Complexity

Total Complexity 0
Complexity/F 0

Size

Lines of Code 74
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 12
Bugs 3 Features 0
Metric Value
cc 0
nc 1
dl 0
loc 74
rs 10
c 12
b 3
f 0
wmc 0
mnd 0
bc 0
fnc 0
bpm 0
cpm 0
noi 0
1
/*!
2
 * byte-data
3
 * Readable data to and from byte buffers.
4
 * Copyright (c) 2017 Rafael da Silva Rocha.
5
 * https://github.com/rochars/byte-data
6
 *
7
 */
8
9
let toBytes = require("./src/to-bytes");
10
let fromBytes = require("./src/from-bytes");
11
let bitPacker = require("./src/bit-packer");
12
let api = require("./src/api");
13
14
// interface
15
module.exports.pack = api.pack;
16
module.exports.findString = api.findString;
17
module.exports.unpack = api.unpack;
18
module.exports.packArray = api.packArray;
19
module.exports.unpackArray = api.unpackArray;
20
module.exports.unpackStruct = api.unpackStruct;
21
module.exports.packStruct = api.packStruct;
22
23
// types: LE
24
module.exports.chr = {"bits": 8, "char": true, "single": true};
25
module.exports.fourCC = {"bits": 32, "char": true, "single": true};
26
module.exports.bool = {"bits": 1, "single": true};
27
module.exports.int2 = {"bits": 2, "signed": true, "single": true};
28
module.exports.uInt2 = {"bits": 2, "single": true};
29
module.exports.int4 = {"bits": 4, "signed": true, "single": true};
30
module.exports.uInt4 = {"bits": 4, "single": true};
31
module.exports.int8 = {"bits": 8, "signed": true, "single": true};
32
module.exports.uInt8 = {"bits": 8, "single": true};
33
module.exports.int16  = {"bits": 16, "signed": true, "single": true};
34
module.exports.uInt16 = {"bits": 16, "single": true};
35
module.exports.float16 = {"bits": 16, "float": true, "single": true};
36
module.exports.int24 = {"bits": 24, "signed": true, "single": true};
37
module.exports.uInt24 = {"bits": 24, "single": true};
38
module.exports.int32 = {"bits": 32, "signed": true, "single": true};
39
module.exports.uInt32 = {"bits": 32, "single": true};
40
module.exports.float32 = {"bits": 32, "float": true, "single": true};
41
module.exports.int40 = {"bits": 40, "signed": true, "single": true};
42
module.exports.uInt40 = {"bits": 40, "single": true};
43
module.exports.int48 = {"bits": 48, "signed": true, "single": true};
44
module.exports.uInt48 = {"bits": 48, "single": true};
45
module.exports.float64 = {"bits": 64, "float": true, "single": true};
46
47
// types: BE
48
module.exports.int16BE  = {
49
    "bits": 16, "signed": true, "single": true, "be": true};
50
module.exports.uInt16BE = {
51
    "bits": 16, "single": true, "be": true};
52
module.exports.float16BE = {
53
    "bits": 16, "float": true, "single": true, "be": true};
54
module.exports.int24BE = {
55
    "bits": 24, "signed": true, "single": true, "be": true};
56
module.exports.uInt24BE = {
57
    "bits": 24, "single": true, "be": true};
58
module.exports.int32BE = {
59
    "bits": 32, "signed": true, "single": true, "be": true};
60
module.exports.uInt32BE = {
61
    "bits": 32, "single": true, "be": true};
62
module.exports.float32BE = {
63
    "bits": 32, "float": true, "single": true, "be": true};
64
module.exports.int40BE = {
65
    "bits": 40, "signed": true, "single": true, "be": true};
66
module.exports.uInt40BE = {
67
    "bits": 40, "single": true, "be": true};
68
module.exports.int48BE = {
69
    "bits": 48, "signed": true, "single": true, "be": true};
70
module.exports.uInt48BE = {
71
    "bits": 48, "single": true, "be": true};
72
module.exports.float64BE = {
73
    "bits": 64, "float": true, "single": true, "be": true};
74
75
module.exports.toBytes = toBytes.toBytes;
76
module.exports.fromBytes = fromBytes.fromBytes;
77
module.exports.packBooleans = bitPacker.packBooleans;
78
module.exports.unpackBooleans = bitPacker.unpackBooleans;
79
module.exports.packCrumbs = bitPacker.packCrumbs;
80
module.exports.unpackCrumbs = bitPacker.unpackCrumbs;
81
module.exports.packNibbles = bitPacker.packNibbles;
82
module.exports.unpackNibbles = bitPacker.unpackNibbles;
83