Passed
Push — master ( 87bc0a...0ea161 )
by Rafael S.
01:21
created

MiniBuffer.readStr   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
dl 0
loc 1
rs 10
c 1
b 0
f 0
nop 3
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.1.0
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
 * Read a number from a buffer.
52
 * @param {!Uint8Array} buffer The bufefr.
53
 * @param {!Object} typeDefinition The type definition.
54
 * @return {number} The number.
55
 */
56
MiniBuffer.read = function(buffer, typeDefinition) {};
0 ignored issues
show
Unused Code introduced by
The parameter typeDefinition is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter buffer is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
57
58
/**
59
 * Write a number to a buffer.
60
 * @param {!Uint8Array} buffer The buffer.
61
 * @param {!Object} typeDefinition The type definition.
62
 * @param {number} num The number to write.
63
 * @param {?number=} index The buffer index to write.
64
 */
65
MiniBuffer.write = function(buffer, typeDefinition, num, index=null) {};
66
67
/**
68
 * Write a ASCII string to a buffer. If the string is smaller
69
 * than the max size the output buffer is filled with 0s.
70
 * @param {!Uint8Array} buffer The buffer.
71
 * @param {string} str The string to be written as bytes.
72
 * @param {number=} size The size of the string.
73
 * @param {?number=} index The buffer index to write.
74
 * @throws {Error} If size + index > buffer.length
75
 */
76
MiniBuffer.writeStr = function(buffer, str, size=str.length, index=null) {};
77
78
/**
79
 * Read a ASCII string from a buffer.
80
 * @param {!Uint8Array} buffer The buffer.
81
 * @param {number} size the max size of the string.
82
 * @param {?number=} index The buffer index to read.
83
 * @return {string} The string.
84
 * @throws {Error} If size + index > buffer.length
85
 */
86
MiniBuffer.readStr = function(buffer, size, index=null) {};
87