index.d.ts   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 49
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 15
mnd 0
bc 0
fnc 2
dl 0
loc 49
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A TwosComplementBuffer.unpack 0 9 1
A TwosComplementBuffer.pack 0 11 1
1
// Type definitions for twos-complement-buffer 1.0.0
2
// Project: https://github.com/rochars/twos-complement-buffer
3
// Definitions by: Rafael da Silva Rocha <https://github.com/rochars>
4
// Definitions: https://github.com/rochars/twos-complement-buffer
5
6
export = TwosComplementBuffer;
7
8
declare module TwosComplementBuffer {
9
10
  class TwosComplementBuffer {
11
    /**
12
     * @param {number} bits The number of bits used by the integer.
13
     */
14
    constructor(bits: number);
15
16
    /**
17
     * The number of bytes used by the number.
18
     * @type {number}
19
     */
20
    bits: number;
21
22
    /**
23
     * The number of bytes used by the number.
24
     * @type {number}
25
     */
26
    bytes: number;
27
28
    /**
29
     * Write one two's complement signed integer to a byte buffer.
30
     * @param {!Uint8Array|!Array<number>} buffer An array of bytes.
31
     * @param {number} num The number.
32
     * @param {number=} index The index being written in the byte buffer.
33
     * @return {number} The next index to write on the byte buffer.
34
     * @throws {TypeError} If num is NaN.
35
     * @throws {RangeError} On overflow.
36
     */
37
    pack(buffer: Uint8Array|number[], num: number, index?: number): number;
38
39
    /**
40
     * Read one two's complement signed integer from a byte buffer.
41
     * @param {!Uint8Array|!Array<number>} buffer An array of bytes.
42
     * @param {number=} index The index to read.
43
     * @return {number}
44
     * @throws {RangeError} On overflow.
45
     */
46
    unpack(buffer: Uint8Array|number[], index?: number): number;
47
  }
48
}
49