Passed
Push — master ( f9d700...6df533 )
by Rafael S.
01:19
created

externs/minibuffer.js   A

Complexity

Total Complexity 5
Complexity/F 1

Size

Lines of Code 60
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 5
eloc 12
c 1
b 0
f 0
nc 1
mnd 0
bc 5
fnc 5
dl 0
loc 60
rs 10
bpm 1
cpm 1
noi 0

5 Functions

Rating   Name   Duplication   Size   Complexity  
A MiniBuffer.readStr 0 1 1
A MiniBuffer.read 0 1 1
A MiniBuffer.clear 0 1 1
A MiniBuffer.writeStr 0 1 1
A MiniBuffer.write 0 1 1
1
/*
2
 * Copyright (c) 2018 Rafael da Silva Rocha.
3
 *
4
 * Permission is hereby granted, free of charge, to any person obtaining
5
 * a copy of this software and associated documentation files (the
6
 * "Software"), to deal in the Software without restriction, including
7
 * without limitation the rights to use, copy, modify, merge, publish,
8
 * distribute, sublicense, and/or sell copies of the Software, and to
9
 * permit persons to whom the Software is furnished to do so, subject to
10
 * the following conditions:
11
 *
12
 * The above copyright notice and this permission notice shall be
13
 * included in all copies or substantial portions of the Software.
14
 *
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
 *
23
 */
24
25
/**
26
 * @fileoverview Externs for minibuffer 0.2
27
 *
28
 * @see https://github.com/rochars/minibuffer
29
 * @externs
30
 */
31
32
/**
33
 * A class to read and write to buffers.
34
 */
35
var MiniBuffer = {};
36
37
// The types param
38
var typeDefinition = {
39
	bits: 0,
40
	signed: false,
41
	float: false,
42
	be: false
43
};
44
45
/**
46
 * @type {number}
47
 */
48
MiniBuffer.head = 0;
49
50
/**
51
 * Set the MiniBuffer head to zero.
52
 */
53
MiniBuffer.clear = function() {};
54
55
/**
56
 * Read a number from a buffer.
57
 * @param {!Uint8Array} buffer The buffer.
58
 * @param {!Object} typeDefinition The type definition.
59
 * @param {?number=} index The index to read.
60
 * @return {number} The number.
61
 * @throws {Error} If word size + index > buffer.length
62
 */
63
MiniBuffer.read = function(buffer, typeDefinition, index=null) {};
64
65
/**
66
 * Write a number to a buffer.
67
 * @param {!Uint8Array} buffer The buffer.
68
 * @param {!Object} typeDefinition The type definition.
69
 * @param {number} num The number to write.
70
 * @param {?number=} index The buffer index to write.
71
 * @throws {Error} If word size + index > buffer.length
72
 */
73
MiniBuffer.write = function(buffer, typeDefinition, num, index=null) {};
74
75
/**
76
 * Write a ASCII string to a buffer. If the string is smaller
77
 * than the max size the output buffer is filled with 0s.
78
 * @param {!Uint8Array} buffer The buffer.
79
 * @param {string} str The string to be written as bytes.
80
 * @param {number=} size The size of the string.
81
 * @param {?number=} index The buffer index to write.
82
 * @throws {Error} If size + index > buffer.length
83
 */
84
MiniBuffer.writeStr = function(buffer, str, size=str.length, index=null) {};
85
86
/**
87
 * Read a ASCII string from a buffer.
88
 * @param {!Uint8Array} buffer The buffer.
89
 * @param {number} size the max size of the string.
90
 * @param {?number=} index The buffer index to read.
91
 * @return {string} The string.
92
 * @throws {Error} If size + index > buffer.length
93
 */
94
MiniBuffer.readStr = function(buffer, size, index=null) {};
95