Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Commit be4f893

Browse files
author
Daniel Wirtz
committed
Interoperability, more...
1 parent ac795ca commit be4f893

27 files changed

+1123
-137
lines changed

ByteBuffer.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ByteBuffer.prototype.array;
4444
ByteBuffer.prototype.offset;
4545

4646
/**
47-
* @type {length}
47+
* @type {number}
4848
*/
4949
ByteBuffer.prototype.length;
5050

@@ -100,6 +100,7 @@ ByteBuffer.prototype.resize = function(capacity) {};
100100
* @param {number} end
101101
* @return {!ByteBuffer}
102102
* @throws {Error}
103+
* @nosideeffects
103104
*/
104105
ByteBuffer.prototype.slice = function(begin, end) {};
105106

@@ -108,6 +109,7 @@ ByteBuffer.prototype.slice = function(begin, end) {};
108109
* @param {number} end
109110
* @returns {!ByteBuffer}
110111
* @throws {Error}
112+
* @nosideeffects
111113
*/
112114
ByteBuffer.prototype.sliceAndCompact = function(begin, end) {};
113115

@@ -129,21 +131,25 @@ ByteBuffer.prototype.reset = function() {};
129131

130132
/**
131133
* @return {!ByteBuffer}
134+
* @nosideeffects
132135
*/
133136
ByteBuffer.prototype.clone = function() {};
134137

135138
/**
136139
* @return {!ByteBuffer}
140+
* @nosideeffects
137141
*/
138142
ByteBuffer.prototype.copy = function() {};
139143

140144
/**
141145
* @return {number}
146+
* @nosideeffects
142147
*/
143148
ByteBuffer.prototype.remaining = function() {};
144149

145150
/**
146151
* @return {number}
152+
* @nosideeffects
147153
*/
148154
ByteBuffer.prototype.capacity = function() {};
149155

@@ -376,15 +382,6 @@ ByteBuffer.prototype.writeLong = function(value, offset) {};
376382
*/
377383
ByteBuffer.prototype.readLong = function(offset) {};
378384

379-
/**
380-
* @param {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array} fromType
381-
* @param {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array} toType
382-
* @param {number} value
383-
* @return {number}
384-
* @nosideeffects
385-
*/
386-
ByteBuffer.cast = function(fromType, toType, value) {};
387-
388385
/**
389386
* @param {number} value
390387
* @param {number=} offset
@@ -522,9 +519,10 @@ ByteBuffer.prototype.writeJSON = function(data, offset, stringify) {};
522519
ByteBuffer.prototype.readJSON = function(offset, parse) {};
523520

524521
/**
522+
* @param {function(string)=} out
525523
* @nosideeffects
526524
*/
527-
ByteBuffer.prototype.printDebug = function() {};
525+
ByteBuffer.prototype.printDebug = function(out) {};
528526

529527
/**
530528
* @param {number=} wrap
@@ -559,6 +557,7 @@ ByteBuffer.prototype.toArrayBuffer = function(forceCopy) {};
559557
* @param {!ByteBuffer} src
560558
* @param {number} offset
561559
* @return {!{char: number, length: number}}
560+
* @nosideeffects
562561
*/
563562
ByteBuffer.decodeUTF8Char = function(src, offset) {};
564563

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,25 @@ A collection of node.js externs for use with [Closure Compiler](https://develope
55
See: [Advanced Compilation and Externs](https://developers.google.com/closure/compiler/docs/api-tutorial3) for details
66

77
#### Naming convention ####
8+
89
* Externs for core components are all lower case
910
* Externs for non-core components begin with an upper case character
1011

12+
#### Node.js specific annotation ####
13+
14+
If an extern file refers to a module that's usually loaded through require(moduleName), a comment is added on top of the
15+
file. For example for the "fs" module:
16+
17+
````javascript
18+
/**
19+
BEGIN_NODE_INCLUDE
20+
var fs = require('fs');
21+
END_NODE_INCLUDE
22+
*/
23+
````
24+
25+
If a file requires a dependency, it is named in the `@fileoverview` declaration.
26+
1127
License
1228
-------
1329
Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html

assert.js

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/*
2+
* Copyright 2012 The Closure Compiler Authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* @fileoverview Definitions for node's assert module
19+
* @see http://nodejs.org/api/assert.html
20+
* @see https://github.com/joyent/node/blob/master/lib/assert.js
21+
* @externs
22+
* @author Daniel Wirtz <[email protected]>
23+
*/
24+
25+
/**
26+
BEGIN_NODE_INCLUDE
27+
var assert = require('assert');
28+
END_NODE_INCLUDE
29+
*/
30+
31+
/**
32+
* @param {*} value
33+
* @param {string} message
34+
* @throws {assert.AssertionError}
35+
*/
36+
var assert = function(value, message) {};
37+
38+
/**
39+
* @param {{message: string, actual: *, expected: *, operator: string}} options
40+
* @constructor
41+
* @extends Error
42+
*/
43+
assert.AssertionError = function(options) {};
44+
45+
/**
46+
* @return {string}
47+
*/
48+
assert.AssertionError.prototype.toString = function() {};
49+
50+
/**
51+
* @param {*} value
52+
* @param {string=} message
53+
* @throws {assert.AssertionError}
54+
*/
55+
assert.ok = function(value, message) {};
56+
57+
/**
58+
* @param {*} actual
59+
* @param {*} expected
60+
* @param {string} message
61+
* @param {string} operator
62+
* @throws {assert.AssertionError}
63+
*/
64+
assert.fail = function(actual, expected, message, operator) {};
65+
66+
/**
67+
* @param {*} actual
68+
* @param {*} expected
69+
* @param {string} message
70+
* @throws {assert.AssertionError}
71+
*/
72+
assert.equal = function(actual, expected, message) {};
73+
74+
/**
75+
* @param {*} actual
76+
* @param {*} expected
77+
* @param {string} message
78+
* @throws {assert.AssertionError}
79+
*/
80+
assert.notEqual = function(actual, expected, message) {};
81+
82+
/**
83+
* @param {*} actual
84+
* @param {*} expected
85+
* @param {string} message
86+
* @throws {assert.AssertionError}
87+
*/
88+
assert.deepEqual = function(actual, expected, message) {};
89+
90+
/**
91+
* @param {*} actual
92+
* @param {*} expected
93+
* @param {string} message
94+
* @throws {assert.AssertionError}
95+
*/
96+
assert.notDeepEqual = function(actual, expected, message) {};
97+
98+
/**
99+
* @param {*} actual
100+
* @param {*} expected
101+
* @param {string} message
102+
* @throws {assert.AssertionError}
103+
*/
104+
assert.strictEqual = function(actual, expected, message) {};
105+
106+
/**
107+
* @param {*} actual
108+
* @param {*} expected
109+
* @param {string} message
110+
* @throws {assert.AssertionError}
111+
*/
112+
assert.notStrictEqual = function(actual, expected, message) {};
113+
114+
/**
115+
* @param {function} block
116+
* @param {Function|RegExp|function(*)} error
117+
* @param {string=} message
118+
* @throws {assert.AssertionError}
119+
*/
120+
assert.throws = function(block, error, message) {};
121+
122+
/**
123+
* @param {function} block
124+
* @param {Function|RegExp|function(*)} error
125+
* @param {string=} message
126+
* @throws {assert.AssertionError}
127+
*/
128+
assert.doesNotThrow = function(block, error, message) {};
129+
130+
/**
131+
* @param {*} value
132+
* @throws {assert.AssertionError}
133+
*/
134+
assert.ifError = function(value) {};

0 commit comments

Comments
 (0)