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

Commit

Permalink
Interoperability, more...
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Wirtz committed Mar 6, 2013
1 parent ac795ca commit be4f893
Show file tree
Hide file tree
Showing 27 changed files with 1,123 additions and 137 deletions.
21 changes: 10 additions & 11 deletions ByteBuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ByteBuffer.prototype.array;
ByteBuffer.prototype.offset;

/**
* @type {length}
* @type {number}
*/
ByteBuffer.prototype.length;

Expand Down Expand Up @@ -100,6 +100,7 @@ ByteBuffer.prototype.resize = function(capacity) {};
* @param {number} end
* @return {!ByteBuffer}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.prototype.slice = function(begin, end) {};

Expand All @@ -108,6 +109,7 @@ ByteBuffer.prototype.slice = function(begin, end) {};
* @param {number} end
* @returns {!ByteBuffer}
* @throws {Error}
* @nosideeffects
*/
ByteBuffer.prototype.sliceAndCompact = function(begin, end) {};

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

/**
* @return {!ByteBuffer}
* @nosideeffects
*/
ByteBuffer.prototype.clone = function() {};

/**
* @return {!ByteBuffer}
* @nosideeffects
*/
ByteBuffer.prototype.copy = function() {};

/**
* @return {number}
* @nosideeffects
*/
ByteBuffer.prototype.remaining = function() {};

/**
* @return {number}
* @nosideeffects
*/
ByteBuffer.prototype.capacity = function() {};

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

/**
* @param {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array} fromType
* @param {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array} toType
* @param {number} value
* @return {number}
* @nosideeffects
*/
ByteBuffer.cast = function(fromType, toType, value) {};

/**
* @param {number} value
* @param {number=} offset
Expand Down Expand Up @@ -522,9 +519,10 @@ ByteBuffer.prototype.writeJSON = function(data, offset, stringify) {};
ByteBuffer.prototype.readJSON = function(offset, parse) {};

/**
* @param {function(string)=} out
* @nosideeffects
*/
ByteBuffer.prototype.printDebug = function() {};
ByteBuffer.prototype.printDebug = function(out) {};

/**
* @param {number=} wrap
Expand Down Expand Up @@ -559,6 +557,7 @@ ByteBuffer.prototype.toArrayBuffer = function(forceCopy) {};
* @param {!ByteBuffer} src
* @param {number} offset
* @return {!{char: number, length: number}}
* @nosideeffects
*/
ByteBuffer.decodeUTF8Char = function(src, offset) {};

Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,25 @@ A collection of node.js externs for use with [Closure Compiler](https://develope
See: [Advanced Compilation and Externs](https://developers.google.com/closure/compiler/docs/api-tutorial3) for details

#### Naming convention ####

* Externs for core components are all lower case
* Externs for non-core components begin with an upper case character

#### Node.js specific annotation ####

If an extern file refers to a module that's usually loaded through require(moduleName), a comment is added on top of the
file. For example for the "fs" module:

````javascript
/**
BEGIN_NODE_INCLUDE
var fs = require('fs');
END_NODE_INCLUDE
*/
````

If a file requires a dependency, it is named in the `@fileoverview` declaration.

License
-------
Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html
134 changes: 134 additions & 0 deletions assert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*
* Copyright 2012 The Closure Compiler Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @fileoverview Definitions for node's assert module
* @see http://nodejs.org/api/assert.html
* @see https://github.com/joyent/node/blob/master/lib/assert.js
* @externs
* @author Daniel Wirtz <[email protected]>
*/

/**
BEGIN_NODE_INCLUDE
var assert = require('assert');
END_NODE_INCLUDE
*/

/**
* @param {*} value
* @param {string} message
* @throws {assert.AssertionError}
*/
var assert = function(value, message) {};

/**
* @param {{message: string, actual: *, expected: *, operator: string}} options
* @constructor
* @extends Error
*/
assert.AssertionError = function(options) {};

/**
* @return {string}
*/
assert.AssertionError.prototype.toString = function() {};

/**
* @param {*} value
* @param {string=} message
* @throws {assert.AssertionError}
*/
assert.ok = function(value, message) {};

/**
* @param {*} actual
* @param {*} expected
* @param {string} message
* @param {string} operator
* @throws {assert.AssertionError}
*/
assert.fail = function(actual, expected, message, operator) {};

/**
* @param {*} actual
* @param {*} expected
* @param {string} message
* @throws {assert.AssertionError}
*/
assert.equal = function(actual, expected, message) {};

/**
* @param {*} actual
* @param {*} expected
* @param {string} message
* @throws {assert.AssertionError}
*/
assert.notEqual = function(actual, expected, message) {};

/**
* @param {*} actual
* @param {*} expected
* @param {string} message
* @throws {assert.AssertionError}
*/
assert.deepEqual = function(actual, expected, message) {};

/**
* @param {*} actual
* @param {*} expected
* @param {string} message
* @throws {assert.AssertionError}
*/
assert.notDeepEqual = function(actual, expected, message) {};

/**
* @param {*} actual
* @param {*} expected
* @param {string} message
* @throws {assert.AssertionError}
*/
assert.strictEqual = function(actual, expected, message) {};

/**
* @param {*} actual
* @param {*} expected
* @param {string} message
* @throws {assert.AssertionError}
*/
assert.notStrictEqual = function(actual, expected, message) {};

/**
* @param {function} block
* @param {Function|RegExp|function(*)} error
* @param {string=} message
* @throws {assert.AssertionError}
*/
assert.throws = function(block, error, message) {};

/**
* @param {function} block
* @param {Function|RegExp|function(*)} error
* @param {string=} message
* @throws {assert.AssertionError}
*/
assert.doesNotThrow = function(block, error, message) {};

/**
* @param {*} value
* @throws {assert.AssertionError}
*/
assert.ifError = function(value) {};
Loading

0 comments on commit be4f893

Please sign in to comment.