aboutsummaryrefslogtreecommitdiffstats
path: root/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules
diff options
context:
space:
mode:
Diffstat (limited to 'signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules')
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Readme.md195
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/index.js851
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/package.json57
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/.dntrc36
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/LICENSE46
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/README.md947
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/build/config.gypi38
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/include_dirs.js1
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/nan.h1910
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/package.json67
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/.npmignore7
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/Makefile12
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/README.md69
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/lib/options.js86
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/package.json50
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/.npmignore5
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/README.md3
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/example.js3
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/package.json43
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/tinycolor.js31
20 files changed, 4457 insertions, 0 deletions
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Readme.md b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Readme.md
new file mode 100644
index 0000000..d164401
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Readme.md
@@ -0,0 +1,195 @@
+# Commander.js
+
+ The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).
+
+ [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)
+
+## Installation
+
+ $ npm install commander
+
+## Option parsing
+
+ Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('commander');
+
+program
+ .version('0.0.1')
+ .option('-p, --peppers', 'Add peppers')
+ .option('-P, --pineapple', 'Add pineapple')
+ .option('-b, --bbq', 'Add bbq sauce')
+ .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
+ .parse(process.argv);
+
+console.log('you ordered a pizza with:');
+if (program.peppers) console.log(' - peppers');
+if (program.pineapple) console.log(' - pineapple');
+if (program.bbq) console.log(' - bbq');
+console.log(' - %s cheese', program.cheese);
+```
+
+ Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
+
+## Automated --help
+
+ The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
+
+```
+ $ ./examples/pizza --help
+
+ Usage: pizza [options]
+
+ Options:
+
+ -V, --version output the version number
+ -p, --peppers Add peppers
+ -P, --pineapple Add pineapple
+ -b, --bbq Add bbq sauce
+ -c, --cheese <type> Add the specified type of cheese [marble]
+ -h, --help output usage information
+
+```
+
+## Coercion
+
+```js
+function range(val) {
+ return val.split('..').map(Number);
+}
+
+function list(val) {
+ return val.split(',');
+}
+
+program
+ .version('0.0.1')
+ .usage('[options] <file ...>')
+ .option('-i, --integer <n>', 'An integer argument', parseInt)
+ .option('-f, --float <n>', 'A float argument', parseFloat)
+ .option('-r, --range <a>..<b>', 'A range', range)
+ .option('-l, --list <items>', 'A list', list)
+ .option('-o, --optional [value]', 'An optional value')
+ .parse(process.argv);
+
+console.log(' int: %j', program.integer);
+console.log(' float: %j', program.float);
+console.log(' optional: %j', program.optional);
+program.range = program.range || [];
+console.log(' range: %j..%j', program.range[0], program.range[1]);
+console.log(' list: %j', program.list);
+console.log(' args: %j', program.args);
+```
+
+## Custom help
+
+ You can display arbitrary `-h, --help` information
+ by listening for "--help". Commander will automatically
+ exit once you are done so that the remainder of your program
+ does not execute causing undesired behaviours, for example
+ in the following executable "stuff" will not output when
+ `--help` is used.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('../');
+
+function list(val) {
+ return val.split(',').map(Number);
+}
+
+program
+ .version('0.0.1')
+ .option('-f, --foo', 'enable some foo')
+ .option('-b, --bar', 'enable some bar')
+ .option('-B, --baz', 'enable some baz');
+
+// must be before .parse() since
+// node's emit() is immediate
+
+program.on('--help', function(){
+ console.log(' Examples:');
+ console.log('');
+ console.log(' $ custom-help --help');
+ console.log(' $ custom-help -h');
+ console.log('');
+});
+
+program.parse(process.argv);
+
+console.log('stuff');
+```
+
+yielding the following help output:
+
+```
+
+Usage: custom-help [options]
+
+Options:
+
+ -h, --help output usage information
+ -V, --version output the version number
+ -f, --foo enable some foo
+ -b, --bar enable some bar
+ -B, --baz enable some baz
+
+Examples:
+
+ $ custom-help --help
+ $ custom-help -h
+
+```
+
+## .outputHelp()
+
+ Output help information without exiting.
+
+## .help()
+
+ Output help information and exit immediately.
+
+## Links
+
+ - [API documentation](http://visionmedia.github.com/commander.js/)
+ - [ascii tables](https://github.com/LearnBoost/cli-table)
+ - [progress bars](https://github.com/visionmedia/node-progress)
+ - [more progress bars](https://github.com/substack/node-multimeter)
+ - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/index.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/index.js
new file mode 100644
index 0000000..790a751
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/index.js
@@ -0,0 +1,851 @@
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter;
+var spawn = require('child_process').spawn;
+var fs = require('fs');
+var exists = fs.existsSync;
+var path = require('path');
+var dirname = path.dirname;
+var basename = path.basename;
+
+/**
+ * Expose the root command.
+ */
+
+exports = module.exports = new Command;
+
+/**
+ * Expose `Command`.
+ */
+
+exports.Command = Command;
+
+/**
+ * Expose `Option`.
+ */
+
+exports.Option = Option;
+
+/**
+ * Initialize a new `Option` with the given `flags` and `description`.
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @api public
+ */
+
+function Option(flags, description) {
+ this.flags = flags;
+ this.required = ~flags.indexOf('<');
+ this.optional = ~flags.indexOf('[');
+ this.bool = !~flags.indexOf('-no-');
+ flags = flags.split(/[ ,|]+/);
+ if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
+ this.long = flags.shift();
+ this.description = description || '';
+}
+
+/**
+ * Return option name.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Option.prototype.name = function(){
+ return this.long
+ .replace('--', '')
+ .replace('no-', '');
+};
+
+/**
+ * Check if `arg` matches the short or long flag.
+ *
+ * @param {String} arg
+ * @return {Boolean}
+ * @api private
+ */
+
+Option.prototype.is = function(arg){
+ return arg == this.short
+ || arg == this.long;
+};
+
+/**
+ * Initialize a new `Command`.
+ *
+ * @param {String} name
+ * @api public
+ */
+
+function Command(name) {
+ this.commands = [];
+ this.options = [];
+ this._execs = [];
+ this._args = [];
+ this._name = name;
+}
+
+/**
+ * Inherit from `EventEmitter.prototype`.
+ */
+
+Command.prototype.__proto__ = EventEmitter.prototype;
+
+/**
+ * Add command `name`.
+ *
+ * The `.action()` callback is invoked when the
+ * command `name` is specified via __ARGV__,
+ * and the remaining arguments are applied to the
+ * function for access.
+ *
+ * When the `name` is "*" an un-matched command
+ * will be passed as the first arg, followed by
+ * the rest of __ARGV__ remaining.
+ *
+ * Examples:
+ *
+ * program
+ * .version('0.0.1')
+ * .option('-C, --chdir <path>', 'change the working directory')
+ * .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
+ * .option('-T, --no-tests', 'ignore test hook')
+ *
+ * program
+ * .command('setup')
+ * .description('run remote setup commands')
+ * .action(function(){
+ * console.log('setup');
+ * });
+ *
+ * program
+ * .command('exec <cmd>')
+ * .description('run the given remote command')
+ * .action(function(cmd){
+ * console.log('exec "%s"', cmd);
+ * });
+ *
+ * program
+ * .command('*')
+ * .description('deploy the given env')
+ * .action(function(env){
+ * console.log('deploying "%s"', env);
+ * });
+ *
+ * program.parse(process.argv);
+ *
+ * @param {String} name
+ * @param {String} [desc]
+ * @return {Command} the new command
+ * @api public
+ */
+
+Command.prototype.command = function(name, desc){
+ var args = name.split(/ +/);
+ var cmd = new Command(args.shift());
+ if (desc) cmd.description(desc);
+ if (desc) this.executables = true;
+ if (desc) this._execs[cmd._name] = true;
+ this.commands.push(cmd);
+ cmd.parseExpectedArgs(args);
+ cmd.parent = this;
+ if (desc) return this;
+ return cmd;
+};
+
+/**
+ * Add an implicit `help [cmd]` subcommand
+ * which invokes `--help` for the given command.
+ *
+ * @api private
+ */
+
+Command.prototype.addImplicitHelpCommand = function() {
+ this.command('help [cmd]', 'display help for [cmd]');
+};
+
+/**
+ * Parse expected `args`.
+ *
+ * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
+ *
+ * @param {Array} args
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.parseExpectedArgs = function(args){
+ if (!args.length) return;
+ var self = this;
+ args.forEach(function(arg){
+ switch (arg[0]) {
+ case '<':
+ self._args.push({ required: true, name: arg.slice(1, -1) });
+ break;
+ case '[':
+ self._args.push({ required: false, name: arg.slice(1, -1) });
+ break;
+ }
+ });
+ return this;
+};
+
+/**
+ * Register callback `fn` for the command.
+ *
+ * Examples:
+ *
+ * program
+ * .command('help')
+ * .description('display verbose help')
+ * .action(function(){
+ * // output help here
+ * });
+ *
+ * @param {Function} fn
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.action = function(fn){
+ var self = this;
+ this.parent.on(this._name, function(args, unknown){
+ // Parse any so-far unknown options
+ unknown = unknown || [];
+ var parsed = self.parseOptions(unknown);
+
+ // Output help if necessary
+ outputHelpIfNecessary(self, parsed.unknown);
+
+ // If there are still any unknown options, then we simply
+ // die, unless someone asked for help, in which case we give it
+ // to them, and then we die.
+ if (parsed.unknown.length > 0) {
+ self.unknownOption(parsed.unknown[0]);
+ }
+
+ // Leftover arguments need to be pushed back. Fixes issue #56
+ if (parsed.args.length) args = parsed.args.concat(args);
+
+ self._args.forEach(function(arg, i){
+ if (arg.required && null == args[i]) {
+ self.missingArgument(arg.name);
+ }
+ });
+
+ // Always append ourselves to the end of the arguments,
+ // to make sure we match the number of arguments the user
+ // expects
+ if (self._args.length) {
+ args[self._args.length] = self;
+ } else {
+ args.push(self);
+ }
+
+ fn.apply(this, args);
+ });
+ return this;
+};
+
+/**
+ * Define option with `flags`, `description` and optional
+ * coercion `fn`.
+ *
+ * The `flags` string should contain both the short and long flags,
+ * separated by comma, a pipe or space. The following are all valid
+ * all will output this way when `--help` is used.
+ *
+ * "-p, --pepper"
+ * "-p|--pepper"
+ * "-p --pepper"
+ *
+ * Examples:
+ *
+ * // simple boolean defaulting to false
+ * program.option('-p, --pepper', 'add pepper');
+ *
+ * --pepper
+ * program.pepper
+ * // => Boolean
+ *
+ * // simple boolean defaulting to false
+ * program.option('-C, --no-cheese', 'remove cheese');
+ *
+ * program.cheese
+ * // => true
+ *
+ * --no-cheese
+ * program.cheese
+ * // => true
+ *
+ * // required argument
+ * program.option('-C, --chdir <path>', 'change the working directory');
+ *
+ * --chdir /tmp
+ * program.chdir
+ * // => "/tmp"
+ *
+ * // optional argument
+ * program.option('-c, --cheese [type]', 'add cheese [marble]');
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @param {Function|Mixed} fn or default
+ * @param {Mixed} defaultValue
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.option = function(flags, description, fn, defaultValue){
+ var self = this
+ , option = new Option(flags, description)
+ , oname = option.name()
+ , name = camelcase(oname);
+
+ // default as 3rd arg
+ if ('function' != typeof fn) defaultValue = fn, fn = null;
+
+ // preassign default value only for --no-*, [optional], or <required>
+ if (false == option.bool || option.optional || option.required) {
+ // when --no-* we make sure default is true
+ if (false == option.bool) defaultValue = true;
+ // preassign only if we have a default
+ if (undefined !== defaultValue) self[name] = defaultValue;
+ }
+
+ // register the option
+ this.options.push(option);
+
+ // when it's passed assign the value
+ // and conditionally invoke the callback
+ this.on(oname, function(val){
+ // coercion
+ if (null != val && fn) val = fn(val);
+
+ // unassigned or bool
+ if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
+ // if no value, bool true, and we have a default, then use it!
+ if (null == val) {
+ self[name] = option.bool
+ ? defaultValue || true
+ : false;
+ } else {
+ self[name] = val;
+ }
+ } else if (null !== val) {
+ // reassign
+ self[name] = val;
+ }
+ });
+
+ return this;
+};
+
+/**
+ * Parse `argv`, settings options and invoking commands when defined.
+ *
+ * @param {Array} argv
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.parse = function(argv){
+ // implicit help
+ if (this.executables) this.addImplicitHelpCommand();
+
+ // store raw args
+ this.rawArgs = argv;
+
+ // guess name
+ this._name = this._name || basename(argv[1]);
+
+ // process argv
+ var parsed = this.parseOptions(this.normalize(argv.slice(2)));
+ var args = this.args = parsed.args;
+
+ var result = this.parseArgs(this.args, parsed.unknown);
+
+ // executable sub-commands
+ var name = result.args[0];
+ if (this._execs[name]) return this.executeSubCommand(argv, args, parsed.unknown);
+
+ return result;
+};
+
+/**
+ * Execute a sub-command executable.
+ *
+ * @param {Array} argv
+ * @param {Array} args
+ * @param {Array} unknown
+ * @api private
+ */
+
+Command.prototype.executeSubCommand = function(argv, args, unknown) {
+ args = args.concat(unknown);
+
+ if (!args.length) this.help();
+ if ('help' == args[0] && 1 == args.length) this.help();
+
+ // <cmd> --help
+ if ('help' == args[0]) {
+ args[0] = args[1];
+ args[1] = '--help';
+ }
+
+ // executable
+ var dir = dirname(argv[1]);
+ var bin = basename(argv[1]) + '-' + args[0];
+
+ // check for ./<bin> first
+ var local = path.join(dir, bin);
+
+ // run it
+ args = args.slice(1);
+ var proc = spawn(local, args, { stdio: 'inherit', customFds: [0, 1, 2] });
+ proc.on('error', function(err){
+ if (err.code == "ENOENT") {
+ console.error('\n %s(1) does not exist, try --help\n', bin);
+ } else if (err.code == "EACCES") {
+ console.error('\n %s(1) not executable. try chmod or run with root\n', bin);
+ }
+ });
+
+ this.runningCommand = proc;
+};
+
+/**
+ * Normalize `args`, splitting joined short flags. For example
+ * the arg "-abc" is equivalent to "-a -b -c".
+ * This also normalizes equal sign and splits "--abc=def" into "--abc def".
+ *
+ * @param {Array} args
+ * @return {Array}
+ * @api private
+ */
+
+Command.prototype.normalize = function(args){
+ var ret = []
+ , arg
+ , lastOpt
+ , index;
+
+ for (var i = 0, len = args.length; i < len; ++i) {
+ arg = args[i];
+ i > 0 && (lastOpt = this.optionFor(args[i-1]));
+
+ if (lastOpt && lastOpt.required) {
+ ret.push(arg);
+ } else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
+ arg.slice(1).split('').forEach(function(c){
+ ret.push('-' + c);
+ });
+ } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
+ ret.push(arg.slice(0, index), arg.slice(index + 1));
+ } else {
+ ret.push(arg);
+ }
+ }
+
+ return ret;
+};
+
+/**
+ * Parse command `args`.
+ *
+ * When listener(s) are available those
+ * callbacks are invoked, otherwise the "*"
+ * event is emitted and those actions are invoked.
+ *
+ * @param {Array} args
+ * @return {Command} for chaining
+ * @api private
+ */
+
+Command.prototype.parseArgs = function(args, unknown){
+ var cmds = this.commands
+ , len = cmds.length
+ , name;
+
+ if (args.length) {
+ name = args[0];
+ if (this.listeners(name).length) {
+ this.emit(args.shift(), args, unknown);
+ } else {
+ this.emit('*', args);
+ }
+ } else {
+ outputHelpIfNecessary(this, unknown);
+
+ // If there were no args and we have unknown options,
+ // then they are extraneous and we need to error.
+ if (unknown.length > 0) {
+ this.unknownOption(unknown[0]);
+ }
+ }
+
+ return this;
+};
+
+/**
+ * Return an option matching `arg` if any.
+ *
+ * @param {String} arg
+ * @return {Option}
+ * @api private
+ */
+
+Command.prototype.optionFor = function(arg){
+ for (var i = 0, len = this.options.length; i < len; ++i) {
+ if (this.options[i].is(arg)) {
+ return this.options[i];
+ }
+ }
+};
+
+/**
+ * Parse options from `argv` returning `argv`
+ * void of these options.
+ *
+ * @param {Array} argv
+ * @return {Array}
+ * @api public
+ */
+
+Command.prototype.parseOptions = function(argv){
+ var args = []
+ , len = argv.length
+ , literal
+ , option
+ , arg;
+
+ var unknownOptions = [];
+
+ // parse options
+ for (var i = 0; i < len; ++i) {
+ arg = argv[i];
+
+ // literal args after --
+ if ('--' == arg) {
+ literal = true;
+ continue;
+ }
+
+ if (literal) {
+ args.push(arg);
+ continue;
+ }
+
+ // find matching Option
+ option = this.optionFor(arg);
+
+ // option is defined
+ if (option) {
+ // requires arg
+ if (option.required) {
+ arg = argv[++i];
+ if (null == arg) return this.optionMissingArgument(option);
+ this.emit(option.name(), arg);
+ // optional arg
+ } else if (option.optional) {
+ arg = argv[i+1];
+ if (null == arg || ('-' == arg[0] && '-' != arg)) {
+ arg = null;
+ } else {
+ ++i;
+ }
+ this.emit(option.name(), arg);
+ // bool
+ } else {
+ this.emit(option.name());
+ }
+ continue;
+ }
+
+ // looks like an option
+ if (arg.length > 1 && '-' == arg[0]) {
+ unknownOptions.push(arg);
+
+ // If the next argument looks like it might be
+ // an argument for this option, we pass it on.
+ // If it isn't, then it'll simply be ignored
+ if (argv[i+1] && '-' != argv[i+1][0]) {
+ unknownOptions.push(argv[++i]);
+ }
+ continue;
+ }
+
+ // arg
+ args.push(arg);
+ }
+
+ return { args: args, unknown: unknownOptions };
+};
+
+/**
+ * Argument `name` is missing.
+ *
+ * @param {String} name
+ * @api private
+ */
+
+Command.prototype.missingArgument = function(name){
+ console.error();
+ console.error(" error: missing required argument `%s'", name);
+ console.error();
+ process.exit(1);
+};
+
+/**
+ * `Option` is missing an argument, but received `flag` or nothing.
+ *
+ * @param {String} option
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.optionMissingArgument = function(option, flag){
+ console.error();
+ if (flag) {
+ console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);
+ } else {
+ console.error(" error: option `%s' argument missing", option.flags);
+ }
+ console.error();
+ process.exit(1);
+};
+
+/**
+ * Unknown option `flag`.
+ *
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.unknownOption = function(flag){
+ console.error();
+ console.error(" error: unknown option `%s'", flag);
+ console.error();
+ process.exit(1);
+};
+
+
+/**
+ * Set the program version to `str`.
+ *
+ * This method auto-registers the "-V, --version" flag
+ * which will print the version number when passed.
+ *
+ * @param {String} str
+ * @param {String} flags
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.version = function(str, flags){
+ if (0 == arguments.length) return this._version;
+ this._version = str;
+ flags = flags || '-V, --version';
+ this.option(flags, 'output the version number');
+ this.on('version', function(){
+ console.log(str);
+ process.exit(0);
+ });
+ return this;
+};
+
+/**
+ * Set the description `str`.
+ *
+ * @param {String} str
+ * @return {String|Command}
+ * @api public
+ */
+
+Command.prototype.description = function(str){
+ if (0 == arguments.length) return this._description;
+ this._description = str;
+ return this;
+};
+
+/**
+ * Set / get the command usage `str`.
+ *
+ * @param {String} str
+ * @return {String|Command}
+ * @api public
+ */
+
+Command.prototype.usage = function(str){
+ var args = this._args.map(function(arg){
+ return arg.required
+ ? '<' + arg.name + '>'
+ : '[' + arg.name + ']';
+ });
+
+ var usage = '[options'
+ + (this.commands.length ? '] [command' : '')
+ + ']'
+ + (this._args.length ? ' ' + args : '');
+
+ if (0 == arguments.length) return this._usage || usage;
+ this._usage = str;
+
+ return this;
+};
+
+/**
+ * Return the largest option length.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+Command.prototype.largestOptionLength = function(){
+ return this.options.reduce(function(max, option){
+ return Math.max(max, option.flags.length);
+ }, 0);
+};
+
+/**
+ * Return help for options.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.optionHelp = function(){
+ var width = this.largestOptionLength();
+
+ // Prepend the help information
+ return [pad('-h, --help', width) + ' ' + 'output usage information']
+ .concat(this.options.map(function(option){
+ return pad(option.flags, width)
+ + ' ' + option.description;
+ }))
+ .join('\n');
+};
+
+/**
+ * Return command help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.commandHelp = function(){
+ if (!this.commands.length) return '';
+ return [
+ ''
+ , ' Commands:'
+ , ''
+ , this.commands.map(function(cmd){
+ var args = cmd._args.map(function(arg){
+ return arg.required
+ ? '<' + arg.name + '>'
+ : '[' + arg.name + ']';
+ }).join(' ');
+
+ return pad(cmd._name
+ + (cmd.options.length
+ ? ' [options]'
+ : '') + ' ' + args, 22)
+ + (cmd.description()
+ ? ' ' + cmd.description()
+ : '');
+ }).join('\n').replace(/^/gm, ' ')
+ , ''
+ ].join('\n');
+};
+
+/**
+ * Return program help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.helpInformation = function(){
+ return [
+ ''
+ , ' Usage: ' + this._name + ' ' + this.usage()
+ , '' + this.commandHelp()
+ , ' Options:'
+ , ''
+ , '' + this.optionHelp().replace(/^/gm, ' ')
+ , ''
+ , ''
+ ].join('\n');
+};
+
+/**
+ * Output help information for this command
+ *
+ * @api public
+ */
+
+Command.prototype.outputHelp = function(){
+ process.stdout.write(this.helpInformation());
+ this.emit('--help');
+};
+
+/**
+ * Output help information and exit.
+ *
+ * @api public
+ */
+
+Command.prototype.help = function(){
+ this.outputHelp();
+ process.exit();
+};
+
+/**
+ * Camel-case the given `flag`
+ *
+ * @param {String} flag
+ * @return {String}
+ * @api private
+ */
+
+function camelcase(flag) {
+ return flag.split('-').reduce(function(str, word){
+ return str + word[0].toUpperCase() + word.slice(1);
+ });
+}
+
+/**
+ * Pad `str` to `width`.
+ *
+ * @param {String} str
+ * @param {Number} width
+ * @return {String}
+ * @api private
+ */
+
+function pad(str, width) {
+ var len = Math.max(0, width - str.length);
+ return str + Array(len + 1).join(' ');
+}
+
+/**
+ * Output help information if necessary
+ *
+ * @param {Command} command to output help for
+ * @param {Array} array of options to search for -h or --help
+ * @api private
+ */
+
+function outputHelpIfNecessary(cmd, options) {
+ options = options || [];
+ for (var i = 0; i < options.length; i++) {
+ if (options[i] == '--help' || options[i] == '-h') {
+ cmd.outputHelp();
+ process.exit(0);
+ }
+ }
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/package.json b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/package.json
new file mode 100644
index 0000000..7f046f1
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/package.json
@@ -0,0 +1,57 @@
+{
+ "name": "commander",
+ "version": "2.1.0",
+ "description": "the complete solution for node.js command-line programs",
+ "keywords": [
+ "command",
+ "option",
+ "parser",
+ "prompt",
+ "stdin"
+ ],
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/visionmedia/commander.js.git"
+ },
+ "devDependencies": {
+ "should": ">= 0.0.1"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "main": "index",
+ "engines": {
+ "node": ">= 0.6.x"
+ },
+ "files": [
+ "index.js"
+ ],
+ "bugs": {
+ "url": "https://github.com/visionmedia/commander.js/issues"
+ },
+ "homepage": "https://github.com/visionmedia/commander.js",
+ "_id": "commander@2.1.0",
+ "dist": {
+ "shasum": "d121bbae860d9992a3d517ba96f56588e47c6781",
+ "tarball": "http://registry.npmjs.org/commander/-/commander-2.1.0.tgz"
+ },
+ "_from": "commander@~2.1.0",
+ "_npmVersion": "1.3.14",
+ "_npmUser": {
+ "name": "tjholowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "maintainers": [
+ {
+ "name": "tjholowaychuk",
+ "email": "tj@vision-media.ca"
+ }
+ ],
+ "directories": {},
+ "_shasum": "d121bbae860d9992a3d517ba96f56588e47c6781",
+ "_resolved": "https://registry.npmjs.org/commander/-/commander-2.1.0.tgz"
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/.dntrc b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/.dntrc
new file mode 100644
index 0000000..1c3e624
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/.dntrc
@@ -0,0 +1,36 @@
+## DNT config file
+## see https://github.com/rvagg/dnt
+
+NODE_VERSIONS="\
+ master \
+ v0.11.13 \
+ v0.11.10 \
+ v0.11.9 \
+ v0.11.8 \
+ v0.11.7 \
+ v0.11.6 \
+ v0.11.5 \
+ v0.11.4 \
+ v0.10.26 \
+ v0.10.25 \
+ v0.10.24 \
+ v0.10.23 \
+ v0.10.22 \
+ v0.10.21 \
+ v0.10.20 \
+ v0.10.19 \
+ v0.10.18 \
+ v0.8.26 \
+ v0.8.25 \
+ v0.8.24 \
+ v0.8.23 \
+ v0.8.22 \
+"
+OUTPUT_PREFIX="nan-"
+TEST_CMD="\
+ cd /dnt/test/ && \
+ npm install && \
+ node_modules/.bin/node-gyp --nodedir /usr/src/node/ rebuild && \
+ node_modules/.bin/tap --gc js/*-test.js; \
+"
+
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/LICENSE b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/LICENSE
new file mode 100644
index 0000000..d502e18
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/LICENSE
@@ -0,0 +1,46 @@
+Copyright 2013, NAN contributors:
+ - Rod Vagg <https://github.com/rvagg>
+ - Benjamin Byholm <https://github.com/kkoopa>
+ - Trevor Norris <https://github.com/trevnorris>
+ - Nathan Rajlich <https://github.com/TooTallNate>
+ - Brett Lawson <https://github.com/brett19>
+ - Ben Noordhuis <https://github.com/bnoordhuis>
+(the "Original Author")
+All rights reserved.
+
+MIT +no-false-attribs License
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+Distributions of all or part of the Software intended to be used
+by the recipients as they would use the unmodified Software,
+containing modifications that substantially alter, remove, or
+disable functionality of the Software, outside of the documented
+configuration mechanisms provided by the Software, shall be
+modified such that the Original Author's bug reporting email
+addresses and urls are either replaced with the contact information
+of the parties responsible for the changes, or removed entirely.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+
+Except where noted, this license applies to any and all software
+programs and associated documentation files created by the
+Original Author, when distributed with the Software.
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/README.md b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/README.md
new file mode 100644
index 0000000..7c8d688
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/README.md
@@ -0,0 +1,947 @@
+Native Abstractions for Node.js
+===============================
+
+**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10 and 0.11, and eventually 0.12.**
+
+***Current version: 1.0.0*** *(See [nan.h](https://github.com/rvagg/nan/blob/master/nan.h) for complete ChangeLog)*
+
+[![NPM](https://nodei.co/npm/nan.png?downloads=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6)](https://nodei.co/npm/nan/)
+
+Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.11/0.12, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a bit more pleasant.
+
+ * **[News & Updates](#news)**
+ * **[Usage](#usage)**
+ * **[Example](#example)**
+ * **[API](#api)**
+
+<a name="news"></a>
+## News & Updates
+
+### May-2013: Major changes for V8 3.25 / Node 0.11.13
+
+Node 0.11.11 and 0.11.12 were both broken releases for native add-ons, you simply can't properly compile against either of them for different reasons. But we now have a 0.11.13 release that jumps a couple of versions of V8 ahead and includes some more, major (traumatic) API changes.
+
+Because we are now nearing Node 0.12 and estimate that the version of V8 we are using in Node 0.11.13 will be close to the API we get for 0.12, we have taken the opportunity to not only *fix* NAN for 0.11.13 but make some major changes to improve the NAN API.
+
+We have **removed support for Node 0.11 versions prior to 0.11.13**, (although our tests are still passing for 0.11.10). As usual, our tests are run against (and pass) the last 5 versions of Node 0.8 and Node 0.10. We also include Node 0.11.13 obviously.
+
+The major change is something that [Benjamin Byholm](kkoopa) has put many hours in to. We now have a fantastic new `NanNew<T>(args)` interface for creating new `Local`s, this replaces `NanNewLocal()` and much more. If you look in [./nan.h](nan.h) you'll see a large number of overloaded versions of this method. In general you should be able to `NanNew<Type>(arguments)` for any type you want to make a `Local` from. This includes `Persistent` types, so we now have a `Local<T> NanNew(const Persistent<T> arg)` to replace `NanPersistentToLocal()`.
+
+We also now have `NanUndefined()`, `NanNull()`, `NanTrue()` and `NanFalse()`. Mainly because of the new requirement for an `Isolate` argument for each of the native V8 versions of this.
+
+V8 has now introduced an `EscapableHandleScope` from which you `scope.Escape(Local<T> value)` to *return* a value from a one scope to another. This replaces the standard `HandleScope` and `scope.Close(Local<T> value)`, although `HandleScope` still exists for when you don't need to return a handle to the caller. For NAN we are exposing it as `NanEscapableScope()` and `NanEscapeScope()`, while `NanScope()` is still how you create a new scope that doesn't need to return handles. For older versions of Node/V8, it'll still map to the older `HandleScope` functionality.
+
+`NanFromV8String()` was deprecated and has now been removed. You should use `NanCString()` or `NanRawString()` instead.
+
+Because `node::MakeCallback()` now takes an `Isolate`, and because it doesn't exist in older versions of Node, we've introduced `NanMakeCallabck()`. You should *always* use this when calling a JavaScript function from C++.
+
+There's lots more, check out the Changelog in nan.h or look through [#86](https://github.com/rvagg/nan/pull/86) for all the gory details.
+
+### Dec-2013: NanCString and NanRawString
+
+Two new functions have been introduced to replace the functionality that's been provided by `NanFromV8String` until now. NanCString has sensible defaults so it's super easy to fetch a null-terminated c-style string out of a `v8::String`. `NanFromV8String` is still around and has defaults that allow you to pass a single handle to fetch a `char*` while `NanRawString` requires a little more attention to arguments.
+
+### Nov-2013: Node 0.11.9+ breaking V8 change
+
+The version of V8 that's shipping with Node 0.11.9+ has changed the signature for new `Local`s to: `v8::Local<T>::New(isolate, value)`, i.e. introducing the `isolate` argument and therefore breaking all new `Local` declarations for previous versions. NAN 0.6+ now includes a `NanNewLocal<T>(value)` that can be used in place to work around this incompatibility and maintain compatibility with 0.8->0.11.9+ (minus a few early 0.11 releases).
+
+For example, if you wanted to return a `null` on a callback you will have to change the argument from `v8::Local<v8::Value>::New(v8::Null())` to `NanNewLocal<v8::Value>(v8::Null())`.
+
+### Nov-2013: Change to binding.gyp `"include_dirs"` for NAN
+
+Inclusion of NAN in a project's binding.gyp is now greatly simplified. You can now just use `"<!(node -e \"require('nan')\")"` in your `"include_dirs"`, see example below (note Windows needs the quoting around `require` to be just right: `"require('nan')"` with appropriate `\` escaping).
+
+<a name="usage"></a>
+## Usage
+
+Simply add **NAN** as a dependency in the *package.json* of your Node addon:
+
+``` bash
+$ npm install --save nan
+```
+
+Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include <nan.h>` in your *.cpp* files:
+
+``` python
+"include_dirs" : [
+ "<!(node -e \"require('nan')\")"
+]
+```
+
+This works like a `-I<path-to-NAN>` when compiling your addon.
+
+<a name="example"></a>
+## Example
+
+See **[LevelDOWN](https://github.com/rvagg/node-leveldown/pull/48)** for a full example of **NAN** in use.
+
+For a simpler example, see the **[async pi estimation example](https://github.com/rvagg/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**.
+
+Compare to the current 0.10 version of this example, found in the [node-addon-examples](https://github.com/rvagg/node-addon-examples/tree/master/9_async_work) repository and also a 0.11 version of the same found [here](https://github.com/kkoopa/node-addon-examples/tree/5c01f58fc993377a567812597e54a83af69686d7/9_async_work).
+
+Note that there is no embedded version sniffing going on here and also the async work is made much simpler, see below for details on the `NanAsyncWorker` class.
+
+```c++
+// addon.cc
+#include <node.h>
+#include <nan.h>
+// ...
+
+using v8::FunctionTemplate;
+using v8::Handle;
+using v8::Object;
+
+void InitAll(Handle<Object> exports) {
+ exports->Set(NanSymbol("calculateSync"),
+ NanNew<FunctionTemplate>(CalculateSync)->GetFunction());
+
+ exports->Set(NanSymbol("calculateAsync"),
+ NanNew<FunctionTemplate>(CalculateAsync)->GetFunction());
+}
+
+NODE_MODULE(addon, InitAll)
+```
+
+```c++
+// sync.h
+#include <node.h>
+#include <nan.h>
+
+NAN_METHOD(CalculateSync);
+```
+
+```c++
+// sync.cc
+#include <node.h>
+#include <nan.h>
+#include "./sync.h"
+// ...
+
+using v8::Number;
+
+// Simple synchronous access to the `Estimate()` function
+NAN_METHOD(CalculateSync) {
+ NanScope();
+
+ // expect a number as the first argument
+ int points = args[0]->Uint32Value();
+ double est = Estimate(points);
+
+ NanReturnValue(NanNew<Number>(est));
+}
+```
+
+```c++
+// async.cc
+#include <node.h>
+#include <nan.h>
+#include "./async.h"
+
+// ...
+
+using v8::Function;
+using v8::Local;
+using v8::Null;
+using v8::Number;
+using v8::Value;
+
+class PiWorker : public NanAsyncWorker {
+ public:
+ PiWorker(NanCallback *callback, int points)
+ : NanAsyncWorker(callback), points(points) {}
+ ~PiWorker() {}
+
+ // Executed inside the worker-thread.
+ // It is not safe to access V8, or V8 data structures
+ // here, so everything we need for input and output
+ // should go on `this`.
+ void Execute () {
+ estimate = Estimate(points);
+ }
+
+ // Executed when the async work is complete
+ // this function will be run inside the main event loop
+ // so it is safe to use V8 again
+ void HandleOKCallback () {
+ NanScope();
+
+ Local<Value> argv[] = {
+ NanNew(NanNull())
+ , NanNew<Number>(estimate)
+ };
+
+ callback->Call(2, argv);
+ };
+
+ private:
+ int points;
+ double estimate;
+};
+
+// Asynchronous access to the `Estimate()` function
+NAN_METHOD(CalculateAsync) {
+ NanScope();
+
+ int points = args[0]->Uint32Value();
+ NanCallback *callback = new NanCallback(args[1].As<Function>());
+
+ NanAsyncQueueWorker(new PiWorker(callback, points));
+ NanReturnUndefined();
+}
+```
+
+<a name="api"></a>
+## API
+
+ * <a href="#api_nan_method"><b><code>NAN_METHOD</code></b></a>
+ * <a href="#api_nan_getter"><b><code>NAN_GETTER</code></b></a>
+ * <a href="#api_nan_setter"><b><code>NAN_SETTER</code></b></a>
+ * <a href="#api_nan_property_getter"><b><code>NAN_PROPERTY_GETTER</code></b></a>
+ * <a href="#api_nan_property_setter"><b><code>NAN_PROPERTY_SETTER</code></b></a>
+ * <a href="#api_nan_property_enumerator"><b><code>NAN_PROPERTY_ENUMERATOR</code></b></a>
+ * <a href="#api_nan_property_deleter"><b><code>NAN_PROPERTY_DELETER</code></b></a>
+ * <a href="#api_nan_property_query"><b><code>NAN_PROPERTY_QUERY</code></b></a>
+ * <a href="#api_nan_index_getter"><b><code>NAN_INDEX_GETTER</code></b></a>
+ * <a href="#api_nan_index_setter"><b><code>NAN_INDEX_SETTER</code></b></a>
+ * <a href="#api_nan_index_enumerator"><b><code>NAN_INDEX_ENUMERATOR</code></b></a>
+ * <a href="#api_nan_index_deleter"><b><code>NAN_INDEX_DELETER</code></b></a>
+ * <a href="#api_nan_index_query"><b><code>NAN_INDEX_QUERY</code></b></a>
+ * <a href="#api_nan_weak_callback"><b><code>NAN_WEAK_CALLBACK</code></b></a>
+ * <a href="#api_nan_deprecated"><b><code>NAN_DEPRECATED</code></b></a>
+ * <a href="#api_nan_inline"><b><code>NAN_INLINE</code></b></a>
+ * <a href="#api_nan_new"><b><code>NanNew</code></b></a>
+ * <a href="#api_nan_undefined"><b><code>NanUndefined</code></b></a>
+ * <a href="#api_nan_null"><b><code>NanNull</code></b></a>
+ * <a href="#api_nan_true"><b><code>NanTrue</code></b></a>
+ * <a href="#api_nan_false"><b><code>NanFalse</code></b></a>
+ * <a href="#api_nan_return_value"><b><code>NanReturnValue</code></b></a>
+ * <a href="#api_nan_return_undefined"><b><code>NanReturnUndefined</code></b></a>
+ * <a href="#api_nan_return_null"><b><code>NanReturnNull</code></b></a>
+ * <a href="#api_nan_return_empty_string"><b><code>NanReturnEmptyString</code></b></a>
+ * <a href="#api_nan_scope"><b><code>NanScope</code></b></a>
+ * <a href="#api_nan_escapable_scope"><b><code>NanEscapableScope</code></b></a>
+ * <a href="#api_nan_escape_scope"><b><code>NanEscapeScope</code></b></a>
+ * <a href="#api_nan_locker"><b><code>NanLocker</code></b></a>
+ * <a href="#api_nan_unlocker"><b><code>NanUnlocker</code></b></a>
+ * <a href="#api_nan_get_internal_field_pointer"><b><code>NanGetInternalFieldPointer</code></b></a>
+ * <a href="#api_nan_set_internal_field_pointer"><b><code>NanSetInternalFieldPointer</code></b></a>
+ * <a href="#api_nan_object_wrap_handle"><b><code>NanObjectWrapHandle</code></b></a>
+ * <a href="#api_nan_symbol"><b><code>NanSymbol</code></b></a>
+ * <a href="#api_nan_get_pointer_safe"><b><code>NanGetPointerSafe</code></b></a>
+ * <a href="#api_nan_set_pointer_safe"><b><code>NanSetPointerSafe</code></b></a>
+ * <a href="#api_nan_raw_string"><b><code>NanRawString</code></b></a>
+ * <a href="#api_nan_c_string"><b><code>NanCString</code></b></a>
+ * <a href="#api_nan_boolean_option_value"><b><code>NanBooleanOptionValue</code></b></a>
+ * <a href="#api_nan_uint32_option_value"><b><code>NanUInt32OptionValue</code></b></a>
+ * <a href="#api_nan_error"><b><code>NanError</code></b>, <b><code>NanTypeError</code></b>, <b><code>NanRangeError</code></b></a>
+ * <a href="#api_nan_throw_error"><b><code>NanThrowError</code></b>, <b><code>NanThrowTypeError</code></b>, <b><code>NanThrowRangeError</code></b>, <b><code>NanThrowError(Handle<Value>)</code></b>, <b><code>NanThrowError(Handle<Value>, int)</code></b></a>
+ * <a href="#api_nan_new_buffer_handle"><b><code>NanNewBufferHandle(char *, size_t, FreeCallback, void *)</code></b>, <b><code>NanNewBufferHandle(char *, uint32_t)</code></b>, <b><code>NanNewBufferHandle(uint32_t)</code></b></a>
+ * <a href="#api_nan_buffer_use"><b><code>NanBufferUse(char *, uint32_t)</code></b></a>
+ * <a href="#api_nan_new_context_handle"><b><code>NanNewContextHandle</code></b></a>
+ * <a href="#api_nan_get_current_context"><b><code>NanGetCurrentContext</code></b></a>
+ * <a href="#api_nan_has_instance"><b><code>NanHasInstance</code></b></a>
+ * <a href="#api_nan_dispose_persistent"><b><code>NanDisposePersistent</code></b></a>
+ * <a href="#api_nan_assign_persistent"><b><code>NanAssignPersistent</code></b></a>
+ * <a href="#api_nan_make_weak_persistent"><b><code>NanMakeWeakPersistent</code></b></a>
+ * <a href="#api_nan_set_template"><b><code>NanSetTemplate</code></b></a>
+ * <a href="#api_nan_make_callback"><b><code>NanMakeCallback</code></b></a>
+ * <a href="#api_nan_compile_script"><b><code>NanCompileScript</code></b></a>
+ * <a href="#api_nan_run_script"><b><code>NanRunScript</code></b></a>
+ * <a href="#api_nan_adjust_external_memory"><b><code>NanAdjustExternalMemory</code></b></a>
+ * <a href="#api_nan_add_gc_epilogue_callback"><b><code>NanAddGCEpilogueCallback</code></b></a>
+ * <a href="#api_nan_add_gc_prologue_callback"><b><code>NanAddGCPrologueCallback</code></b></a>
+ * <a href="#api_nan_remove_gc_epilogue_callback"><b><code>NanRemoveGCEpilogueCallback</code></b></a>
+ * <a href="#api_nan_remove_gc_prologue_callback"><b><code>NanRemoveGCPrologueCallback</code></b></a>
+ * <a href="#api_nan_get_heap_statistics"><b><code>NanGetHeapStatistics</code></b></a>
+ * <a href="#api_nan_callback"><b><code>NanCallback</code></b></a>
+ * <a href="#api_nan_async_worker"><b><code>NanAsyncWorker</code></b></a>
+ * <a href="#api_nan_async_queue_worker"><b><code>NanAsyncQueueWorker</code></b></a>
+
+<a name="api_nan_method"></a>
+### NAN_METHOD(methodname)
+
+Use `NAN_METHOD` to define your V8 accessible methods:
+
+```c++
+// .h:
+class Foo : public node::ObjectWrap {
+ ...
+
+ static NAN_METHOD(Bar);
+ static NAN_METHOD(Baz);
+}
+
+
+// .cc:
+NAN_METHOD(Foo::Bar) {
+ ...
+}
+
+NAN_METHOD(Foo::Baz) {
+ ...
+}
+```
+
+The reason for this macro is because of the method signature change in 0.11:
+
+```c++
+// 0.10 and below:
+Handle<Value> name(const Arguments& args)
+
+// 0.11 and above
+void name(const FunctionCallbackInfo<Value>& args)
+```
+
+The introduction of `FunctionCallbackInfo` brings additional complications:
+
+<a name="api_nan_getter"></a>
+### NAN_GETTER(methodname)
+
+Use `NAN_GETTER` to declare your V8 accessible getters. You get a `Local<String>` `property` and an appropriately typed `args` object that can act like the `args` argument to a `NAN_METHOD` call.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_GETTER`.
+
+<a name="api_nan_setter"></a>
+### NAN_SETTER(methodname)
+
+Use `NAN_SETTER` to declare your V8 accessible setters. Same as `NAN_GETTER` but you also get a `Local<Value>` `value` object to work with.
+
+<a name="api_nan_property_getter"></a>
+### NAN_PROPERTY_GETTER(cbname)
+Use `NAN_PROPERTY_GETTER` to declare your V8 accessible property getters. You get a `Local<String>` `property` and an appropriately typed `args` object that can act similar to the `args` argument to a `NAN_METHOD` call.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_GETTER`.
+
+<a name="api_nan_property_setter"></a>
+### NAN_PROPERTY_SETTER(cbname)
+Use `NAN_PROPERTY_SETTER` to declare your V8 accessible property setters. Same as `NAN_PROPERTY_GETTER` but you also get a `Local<Value>` `value` object to work with.
+
+<a name="api_nan_property_enumerator"></a>
+### NAN_PROPERTY_ENUMERATOR(cbname)
+Use `NAN_PROPERTY_ENUMERATOR` to declare your V8 accessible property enumerators. You get an appropriately typed `args` object like the `args` argument to a `NAN_PROPERTY_GETTER` call.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_ENUMERATOR`.
+
+<a name="api_nan_property_deleter"></a>
+### NAN_PROPERTY_DELETER(cbname)
+Use `NAN_PROPERTY_DELETER` to declare your V8 accessible property deleters. Same as `NAN_PROPERTY_GETTER`.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_DELETER`.
+
+<a name="api_nan_property_query"></a>
+### NAN_PROPERTY_QUERY(cbname)
+Use `NAN_PROPERTY_QUERY` to declare your V8 accessible property queries. Same as `NAN_PROPERTY_GETTER`.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_QUERY`.
+
+<a name="api_nan_index_getter"></a>
+### NAN_INDEX_GETTER(cbname)
+Use `NAN_INDEX_GETTER` to declare your V8 accessible index getters. You get a `uint32_t` `index` and an appropriately typed `args` object that can act similar to the `args` argument to a `NAN_METHOD` call.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_INDEX_GETTER`.
+
+<a name="api_nan_index_setter"></a>
+### NAN_INDEX_SETTER(cbname)
+Use `NAN_INDEX_SETTER` to declare your V8 accessible index setters. Same as `NAN_INDEX_GETTER` but you also get a `Local<Value>` `value` object to work with.
+
+<a name="api_nan_index_enumerator"></a>
+### NAN_INDEX_ENUMERATOR(cbname)
+Use `NAN_INDEX_ENUMERATOR` to declare your V8 accessible index enumerators. You get an appropriately typed `args` object like the `args` argument to a `NAN_INDEX_GETTER` call.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_INDEX_ENUMERATOR`.
+
+<a name="api_nan_index_deleter"></a>
+### NAN_INDEX_DELETER(cbname)
+Use `NAN_INDEX_DELETER` to declare your V8 accessible index deleters. Same as `NAN_INDEX_GETTER`.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_INDEX_DELETER`.
+
+<a name="api_nan_index_query"></a>
+### NAN_INDEX_QUERY(cbname)
+Use `NAN_INDEX_QUERY` to declare your V8 accessible index queries. Same as `NAN_INDEX_GETTER`.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_INDEX_QUERY`.
+
+<a name="api_nan_weak_callback"></a>
+### NAN_WEAK_CALLBACK(cbname)
+
+Use `NAN_WEAK_CALLBACK` to define your V8 WeakReference callbacks. Do not use for declaration. There is an argument object `const _NanWeakCallbackData<T, P> &data` allowing access to the weak object and the supplied parameter through its `GetValue` and `GetParameter` methods.
+
+```c++
+NAN_WEAK_CALLBACK(weakCallback) {
+ int *parameter = data.GetParameter();
+ NanMakeCallback(NanGetCurrentContext()->Global(), data.GetValue(), 0, NULL);
+ if ((*parameter)++ == 0) {
+ data.Revive();
+ } else {
+ delete parameter;
+ data.Dispose();
+ }
+}
+```
+
+<a name="api_nan_deprecated"></a>
+### NAN_DEPRECATED
+Declares a function as deprecated.
+
+```c++
+static NAN_DEPRECATED NAN_METHOD(foo) {
+ ...
+}
+```
+
+<a name="api_nan_inline"></a>
+### NAN_INLINE
+Inlines a function.
+
+```c++
+NAN_INLINE int foo(int bar) {
+ ...
+}
+```
+
+<a name="api_nan_new"></a>
+### Local&lt;T&gt; NanNew&lt;T&gt;( ... )
+
+Use `NanNew` to construct almost all v8 objects and make new local handles.
+
+```c++
+Local<String> s = NanNew<String>("value");
+
+...
+
+Persistent<Object> o;
+
+...
+
+Local<Object> lo = NanNew(o);
+
+```
+
+<a name="api_nan_undefined"></a>
+### Handle&lt;Primitive&gt; NanUndefined()
+
+Use instead of `Undefined()`
+
+<a name="api_nan_null"></a>
+### Handle&lt;Primitive&gt; NanNull()
+
+Use instead of `Null()`
+
+<a name="api_nan_true"></a>
+### Handle&lt;Primitive&gt; NanTrue()
+
+Use instead of `True()`
+
+<a name="api_nan_false"></a>
+### Handle&lt;Primitive&gt; NanFalse()
+
+Use instead of `False()`
+
+<a name="api_nan_return_value"></a>
+### NanReturnValue(Handle&lt;Value&gt;)
+
+Use `NanReturnValue` when you want to return a value from your V8 accessible method:
+
+```c++
+NAN_METHOD(Foo::Bar) {
+ ...
+
+ NanReturnValue(NanNew<String>("FooBar!"));
+}
+```
+
+No `return` statement required.
+
+<a name="api_nan_return_undefined"></a>
+### NanReturnUndefined()
+
+Use `NanReturnUndefined` when you don't want to return anything from your V8 accessible method:
+
+```c++
+NAN_METHOD(Foo::Baz) {
+ ...
+
+ NanReturnUndefined();
+}
+```
+
+<a name="api_nan_return_null"></a>
+### NanReturnNull()
+
+Use `NanReturnNull` when you want to return `Null` from your V8 accessible method:
+
+```c++
+NAN_METHOD(Foo::Baz) {
+ ...
+
+ NanReturnNull();
+}
+```
+
+<a name="api_nan_return_empty_string"></a>
+### NanReturnEmptyString()
+
+Use `NanReturnEmptyString` when you want to return an empty `String` from your V8 accessible method:
+
+```c++
+NAN_METHOD(Foo::Baz) {
+ ...
+
+ NanReturnEmptyString();
+}
+```
+
+<a name="api_nan_scope"></a>
+### NanScope()
+
+The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanScope()` necessary, use it in place of `HandleScope scope`:
+
+```c++
+NAN_METHOD(Foo::Bar) {
+ NanScope();
+
+ NanReturnValue(NanNew<String>("FooBar!"));
+}
+```
+
+<a name="api_nan_escapable_scope"></a>
+### NanEscapableScope()
+
+The separation of handle scopes into escapable and inescapable scopes makes `NanEscapableScope()` necessary, use it in place of `HandleScope scope` when you later wish to `Close()` the scope:
+
+```c++
+Handle<String> Foo::Bar() {
+ NanEscapableScope();
+
+ return NanEscapeScope(NanNew<String>("FooBar!"));
+}
+```
+
+<a name="api_nan_esacpe_scope"></a>
+### Local&lt;T&gt; NanEscapeScope(Handle&lt;T&gt; value);
+Use together with `NanEscapableScope` to escape the scope. Corresponds to `HandleScope::Close` or `EscapableHandleScope::Escape`.
+
+<a name="api_nan_locker"></a>
+### NanLocker()
+
+The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanLocker()` necessary, use it in place of `Locker locker`:
+
+```c++
+NAN_METHOD(Foo::Bar) {
+ NanLocker();
+ ...
+ NanUnlocker();
+}
+```
+
+<a name="api_nan_unlocker"></a>
+### NanUnlocker()
+
+The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanUnlocker()` necessary, use it in place of `Unlocker unlocker`:
+
+```c++
+NAN_METHOD(Foo::Bar) {
+ NanLocker();
+ ...
+ NanUnlocker();
+}
+```
+
+<a name="api_nan_get_internal_field_pointer"></a>
+### void * NanGetInternalFieldPointer(Handle&lt;Object&gt;, int)
+
+Gets a pointer to the internal field with at `index` from a V8 `Object` handle.
+
+```c++
+Local<Object> obj;
+...
+NanGetInternalFieldPointer(obj, 0);
+```
+<a name="api_nan_set_internal_field_pointer"></a>
+### void NanSetInternalFieldPointer(Handle&lt;Object&gt;, int, void *)
+
+Sets the value of the internal field at `index` on a V8 `Object` handle.
+
+```c++
+static Persistent<Function> dataWrapperCtor;
+...
+Local<Object> wrapper = NanPersistentToLocal(dataWrapperCtor)->NewInstance();
+NanSetInternalFieldPointer(wrapper, 0, this);
+```
+
+<a name="api_nan_object_wrap_handle"></a>
+### Local&lt;Object&gt; NanObjectWrapHandle(Object)
+
+When you want to fetch the V8 object handle from a native object you've wrapped with Node's `ObjectWrap`, you should use `NanObjectWrapHandle`:
+
+```c++
+NanObjectWrapHandle(iterator)->Get(NanSymbol("end"))
+```
+
+<a name="api_nan_symbol"></a>
+### String NanSymbol(char *)
+
+Use to create string symbol objects (i.e. `v8::String::NewSymbol(x)`), for getting and setting object properties, or names of objects.
+
+```c++
+bool foo = false;
+if (obj->Has(NanSymbol("foo")))
+ foo = optionsObj->Get(NanSymbol("foo"))->BooleanValue()
+```
+
+<a name="api_nan_get_pointer_safe"></a>
+### Type NanGetPointerSafe(Type *[, Type])
+
+A helper for getting values from optional pointers. If the pointer is `NULL`, the function returns the optional default value, which defaults to `0`. Otherwise, the function returns the value the pointer points to.
+
+```c++
+char *plugh(uint32_t *optional) {
+ char res[] = "xyzzy";
+ uint32_t param = NanGetPointerSafe<uint32_t>(optional, 0x1337);
+ switch (param) {
+ ...
+ }
+ NanSetPointerSafe<uint32_t>(optional, 0xDEADBEEF);
+}
+```
+
+<a name="api_nan_set_pointer_safe"></a>
+### bool NanSetPointerSafe(Type *, Type)
+
+A helper for setting optional argument pointers. If the pointer is `NULL`, the function simply returns `false`. Otherwise, the value is assigned to the variable the pointer points to.
+
+```c++
+const char *plugh(size_t *outputsize) {
+ char res[] = "xyzzy";
+ if !(NanSetPointerSafe<size_t>(outputsize, strlen(res) + 1)) {
+ ...
+ }
+
+ ...
+}
+```
+
+<a name="api_nan_raw_string"></a>
+### void* NanRawString(Handle&lt;Value&gt;, enum Nan::Encoding, size_t *, void *, size_t, int)
+
+When you want to convert a V8 `String` to a `char*` buffer, use `NanRawString`. You have to supply an encoding as well as a pointer to a variable that will be assigned the number of bytes in the returned string. It is also possible to supply a buffer and its length to the function in order not to have a new buffer allocated. The final argument allows setting `String::WriteOptions`.
+Just remember that you'll end up with an object that you'll need to `delete[]` at some point unless you supply your own buffer:
+
+```c++
+size_t count;
+void* decoded = NanRawString(args[1], Nan::BASE64, &count, NULL, 0, String::HINT_MANY_WRITES_EXPECTED);
+char param_copy[count];
+memcpy(param_copy, decoded, count);
+delete[] decoded;
+```
+
+<a name="api_nan_c_string"></a>
+### char* NanCString(Handle&lt;Value&gt;, size_t *[, char *, size_t, int])
+
+When you want to convert a V8 `String` to a null-terminated C `char*` use `NanCString`. The resulting `char*` will be UTF-8-encoded, and you need to supply a pointer to a variable that will be assigned the number of bytes in the returned string. It is also possible to supply a buffer and its length to the function in order not to have a new buffer allocated. The final argument allows optionally setting `String::WriteOptions`, which default to `v8::String::NO_OPTIONS`.
+Just remember that you'll end up with an object that you'll need to `delete[]` at some point unless you supply your own buffer:
+
+```c++
+size_t count;
+char* name = NanCString(args[0], &count);
+```
+
+<a name="api_nan_boolean_option_value"></a>
+### bool NanBooleanOptionValue(Handle&lt;Value&gt;, Handle&lt;String&gt;[, bool])
+
+When you have an "options" object that you need to fetch properties from, boolean options can be fetched with this pair. They check first if the object exists (`IsEmpty`), then if the object has the given property (`Has`) then they get and convert/coerce the property to a `bool`.
+
+The optional last parameter is the *default* value, which is `false` if left off:
+
+```c++
+// `foo` is false unless the user supplies a truthy value for it
+bool foo = NanBooleanOptionValue(optionsObj, NanSymbol("foo"));
+// `bar` is true unless the user supplies a falsy value for it
+bool bar = NanBooleanOptionValueDefTrue(optionsObj, NanSymbol("bar"), true);
+```
+
+<a name="api_nan_uint32_option_value"></a>
+### uint32_t NanUInt32OptionValue(Handle&lt;Value&gt;, Handle&lt;String&gt;, uint32_t)
+
+Similar to `NanBooleanOptionValue`, use `NanUInt32OptionValue` to fetch an integer option from your options object. Can be any kind of JavaScript `Number` and it will be coerced to an unsigned 32-bit integer.
+
+Requires all 3 arguments as a default is not optional:
+
+```c++
+uint32_t count = NanUInt32OptionValue(optionsObj, NanSymbol("count"), 1024);
+```
+
+<a name="api_nan_error"></a>
+### NanError(message), NanTypeError(message), NanRangeError(message)
+
+For making `Error`, `TypeError` and `RangeError` objects.
+
+```c++
+Local<Value> res = NanError("you must supply a callback argument");
+```
+
+<a name="api_nan_throw_error"></a>
+### NanThrowError(message), NanThrowTypeError(message), NanThrowRangeError(message), NanThrowError(Local&lt;Value&gt;), NanThrowError(Local&lt;Value&gt;, int)
+
+For throwing `Error`, `TypeError` and `RangeError` objects. You should `return` this call:
+
+```c++
+return NanThrowError("you must supply a callback argument");
+```
+
+Can also handle any custom object you may want to throw. If used with the error code argument, it will add the supplied error code to the error object as a property called `code`.
+
+<a name="api_nan_new_buffer_handle"></a>
+### Local&lt;Object&gt; NanNewBufferHandle(char *, uint32_t), Local&lt;Object&gt; NanNewBufferHandle(uint32_t)
+
+The `Buffer` API has changed a little in Node 0.11, this helper provides consistent access to `Buffer` creation:
+
+```c++
+NanNewBufferHandle((char*)value.data(), value.size());
+```
+
+Can also be used to initialize a `Buffer` with just a `size` argument.
+
+Can also be supplied with a `NanFreeCallback` and a hint for the garbage collector.
+
+<a name="api_nan_buffer_use"></a>
+### Local&lt;Object&gt; NanBufferUse(char*, uint32_t)
+
+`Buffer::New(char*, uint32_t)` prior to 0.11 would make a copy of the data.
+While it was possible to get around this, it required a shim by passing a
+callback. So the new API `Buffer::Use(char*, uint32_t)` was introduced to remove
+needing to use this shim.
+
+`NanBufferUse` uses the `char*` passed as the backing data, and will free the
+memory automatically when the weak callback is called. Keep this in mind, as
+careless use can lead to "double free or corruption" and other cryptic failures.
+
+<a name="api_nan_has_instance"></a>
+### bool NanHasInstance(Persistent&lt;FunctionTemplate&gt;&, Handle&lt;Value&gt;)
+
+Can be used to check the type of an object to determine it is of a particular class you have already defined and have a `Persistent<FunctionTemplate>` handle for.
+
+<a href="#api_nan_new_context_handle">
+### Local&lt;Context&gt; NanNewContextHandle([ExtensionConfiguration*, Handle&lt;ObjectTemplate&gt;, Handle&lt;Value&gt;])
+Creates a new `Local<Context>` handle.
+
+```c++
+Local<FunctionTemplate> ftmpl = NanNew<FunctionTemplate>();
+Local<ObjectTemplate> otmpl = ftmpl->InstanceTemplate();
+Local<Context> ctx = NanNewContextHandle(NULL, otmpl);
+```
+
+<a href="#api_nan_get_current_context">
+### Local<Context> NanGetCurrentContext()
+
+Gets the current context.
+
+```c++
+Local<Context> ctx = NanGetCurrentContext();
+```
+
+<a name="api_nan_dispose_persistent"></a>
+### void NanDisposePersistent(Persistent&lt;T&gt; &)
+
+Use `NanDisposePersistent` to dispose a `Persistent` handle.
+
+```c++
+NanDisposePersistent(persistentHandle);
+```
+
+<a name="api_nan_assign_persistent"></a>
+### NanAssignPersistent(type, handle, object)
+
+Use `NanAssignPersistent` to assign a non-`Persistent` handle to a `Persistent` one. You can no longer just declare a `Persistent` handle and assign directly to it later, you have to `Reset` it in Node 0.11, so this makes it easier.
+
+In general it is now better to place anything you want to protect from V8's garbage collector as properties of a generic `Object` and then assign that to a `Persistent`. This works in older versions of Node also if you use `NanAssignPersistent`:
+
+```c++
+Persistent<Object> persistentHandle;
+
+...
+
+Local<Object> obj = NanNew<Object>();
+obj->Set(NanSymbol("key"), keyHandle); // where keyHandle might be a Local<String>
+NanAssignPersistent(Object, persistentHandle, obj)
+```
+
+<a name="api_nan_make_weak_persistent"></a>
+### NanMakeWeakPersistent(Handle&lt;T&gt; handle, P* parameter, _NanWeakCallbackInfo&lt;T, P&gt;::Callback callback)
+
+Creates a weak persistent handle with the supplied parameter and `NAN_WEAK_CALLBACK`. The callback has to be fully specialized to work on all versions of Node.
+
+```c++
+NAN_WEAK_CALLBACK(weakCallback) {
+
+...
+
+}
+
+Local<Function> func;
+
+...
+
+int *parameter = new int(0);
+NanMakeWeakPersistent(func, parameter, &weakCallback<Function, int>);
+```
+
+<a name="api_nan_set_template"></a>
+### NanSetTemplate(templ, name, value)
+
+Use to add properties on object and function templates.
+
+<a name="api_nan_make_callback"></a>
+### NanMakeCallback(target, func, argc, argv)
+
+Use instead of `node::MakeCallback` to call javascript functions. This is the only proper way of calling functions.
+
+<a name="api_nan_compile_script"></a>
+### NanCompileScript(Handle<String> s [, const ScriptOrigin&amp; origin])
+
+Use to create new scripts bound to the current context.
+
+<a name="api_nan_run_script"></a>
+### NanRunScript(script)
+
+Use to run both bound and unbound scripts.
+
+<a name="api_nan_adjust_external_memory"></a>
+### NanAdjustExternalMemory(int change_in_bytes)
+
+Simply does `AdjustAmountOfExternalAllocatedMemory`
+
+<a name="api_nan_add_gc_epilogue_callback"></a>
+### NanAddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type_filter=kGCTypeAll)
+
+Simply does `AddGCEpilogueCallback`
+
+<a name="api_nan_add_gc_prologue_callback"></a>
+### NanAddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type_filter=kGCTypeAll)
+
+Simply does `AddGCPrologueCallback`
+
+<a name="api_nan_remove_gc_epilogue_callback"></a>
+### NanRemoveGCEpilogueCallback(GCEpilogueCallback callback)
+
+Simply does `RemoveGCEpilogueCallback`
+
+<a name="api_nan_add_gc_prologue_callback"></a>
+### NanRemoveGCPrologueCallback(GCPrologueCallback callback)
+
+Simply does `RemoveGCPrologueCallback`
+
+<a name="api_nan_get_heap_statistics"></a>
+### NanGetHeapStatistics(HeapStatistics *heap_statistics)
+
+Simply does `GetHeapStatistics`
+
+<a name="api_nan_callback"></a>
+### NanCallback
+
+Because of the difficulties imposed by the changes to `Persistent` handles in V8 in Node 0.11, creating `Persistent` versions of your `Handle<Function>` is annoyingly tricky. `NanCallback` makes it easier by taking your handle, making it persistent until the `NanCallback` is deleted and even providing a handy `Call()` method to fetch and execute the callback `Function`.
+
+```c++
+Local<Function> callbackHandle = args[0].As<Function>();
+NanCallback *callback = new NanCallback(callbackHandle);
+// pass `callback` around and it's safe from GC until you:
+delete callback;
+```
+
+You can execute the callback like so:
+
+```c++
+// no arguments:
+callback->Call(0, NULL);
+
+// an error argument:
+Handle<Value> argv[] = {
+ NanError(NanNew<String>("fail!"))
+};
+callback->Call(1, argv);
+
+// a success argument:
+Handle<Value> argv[] = {
+ NanNull(),
+ NanNew<String>("w00t!")
+};
+callback->Call(2, argv);
+```
+
+`NanCallback` also has a `Local<Function> GetCallback()` method that you can use
+to fetch a local handle to the underlying callback function, as well as a
+`void SetFunction(Handle<Function>)` for setting the callback on the
+`NanCallback`. Additionally a generic constructor is available for using
+`NanCallback` without performing heap allocations.
+
+<a name="api_nan_async_worker"></a>
+### NanAsyncWorker
+
+`NanAsyncWorker` is an abstract class that you can subclass to have much of the annoying async queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the async work is in progress.
+
+See a rough outline of the implementation:
+
+```c++
+class NanAsyncWorker {
+public:
+ NanAsyncWorker (NanCallback *callback);
+
+ // Clean up persistent handles and delete the *callback
+ virtual ~NanAsyncWorker ();
+
+ // Check the `char *errmsg` property and call HandleOKCallback()
+ // or HandleErrorCallback depending on whether it has been set or not
+ virtual void WorkComplete ();
+
+ // You must implement this to do some async work. If there is an
+ // error then allocate `errmsg` to a message and the callback will
+ // be passed that string in an Error object
+ virtual void Execute ();
+
+ // Save a V8 object in a Persistent handle to protect it from GC
+ void SavePersistent(const char *key, Local<Object> &obj);
+
+ // Fetch a stored V8 object (don't call from within `Execute()`)
+ Local<Object> GetFromPersistent(const char *key);
+
+protected:
+ // Set this if there is an error, otherwise it's NULL
+ const char *errmsg;
+
+ // Default implementation calls the callback function with no arguments.
+ // Override this to return meaningful data
+ virtual void HandleOKCallback ();
+
+ // Default implementation calls the callback function with an Error object
+ // wrapping the `errmsg` string
+ virtual void HandleErrorCallback ();
+};
+```
+
+<a name="api_nan_async_queue_worker"></a>
+### NanAsyncQueueWorker(NanAsyncWorker *)
+
+`NanAsyncQueueWorker` will run a `NanAsyncWorker` asynchronously via libuv. Both the *execute* and *after_work* steps are taken care of for you&mdash;most of the logic for this is embedded in `NanAsyncWorker`.
+
+### Contributors
+
+NAN is only possible due to the excellent work of the following contributors:
+
+<table><tbody>
+<tr><th align="left">Rod Vagg</th><td><a href="https://github.com/rvagg">GitHub/rvagg</a></td><td><a href="http://twitter.com/rvagg">Twitter/@rvagg</a></td></tr>
+<tr><th align="left">Benjamin Byholm</th><td><a href="https://github.com/kkoopa/">GitHub/kkoopa</a></td></tr>
+<tr><th align="left">Trevor Norris</th><td><a href="https://github.com/trevnorris">GitHub/trevnorris</a></td><td><a href="http://twitter.com/trevnorris">Twitter/@trevnorris</a></td></tr>
+<tr><th align="left">Nathan Rajlich</th><td><a href="https://github.com/TooTallNate">GitHub/TooTallNate</a></td><td><a href="http://twitter.com/TooTallNate">Twitter/@TooTallNate</a></td></tr>
+<tr><th align="left">Brett Lawson</th><td><a href="https://github.com/brett19">GitHub/brett19</a></td><td><a href="http://twitter.com/brett19x">Twitter/@brett19x</a></td></tr>
+<tr><th align="left">Ben Noordhuis</th><td><a href="https://github.com/bnoordhuis">GitHub/bnoordhuis</a></td><td><a href="http://twitter.com/bnoordhuis">Twitter/@bnoordhuis</a></td></tr>
+</tbody></table>
+
+Licence &amp; copyright
+-----------------------
+
+Copyright (c) 2014 NAN contributors (listed above).
+
+Native Abstractions for Node.js is licensed under an MIT +no-false-attribs license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/build/config.gypi b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/build/config.gypi
new file mode 100644
index 0000000..e085a50
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/build/config.gypi
@@ -0,0 +1,38 @@
+# Do not edit. File was generated by node-gyp's "configure" step
+{
+ "target_defaults": {
+ "cflags": [],
+ "default_configuration": "Release",
+ "defines": [],
+ "include_dirs": [],
+ "libraries": []
+ },
+ "variables": {
+ "clang": 0,
+ "gcc_version": 47,
+ "host_arch": "x64",
+ "node_install_npm": "true",
+ "node_prefix": "",
+ "node_shared_cares": "false",
+ "node_shared_http_parser": "false",
+ "node_shared_libuv": "false",
+ "node_shared_openssl": "false",
+ "node_shared_v8": "false",
+ "node_shared_zlib": "false",
+ "node_tag": "",
+ "node_unsafe_optimizations": 0,
+ "node_use_dtrace": "false",
+ "node_use_etw": "false",
+ "node_use_openssl": "true",
+ "node_use_perfctr": "false",
+ "node_use_systemtap": "false",
+ "python": "/usr/bin/python",
+ "target_arch": "x64",
+ "v8_enable_gdbjit": 0,
+ "v8_no_strict_aliasing": 1,
+ "v8_use_snapshot": "true",
+ "nodedir": "/home/rvagg/.node-gyp/0.10.21",
+ "copy_dev_lib": "true",
+ "standalone_static_library": 1
+ }
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/include_dirs.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/include_dirs.js
new file mode 100644
index 0000000..4f1dfb4
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/include_dirs.js
@@ -0,0 +1 @@
+console.log(require('path').relative('.', __dirname));
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/nan.h b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/nan.h
new file mode 100644
index 0000000..bc544f5
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/nan.h
@@ -0,0 +1,1910 @@
+/**********************************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2014 NAN contributors:
+ * - Rod Vagg <https://github.com/rvagg>
+ * - Benjamin Byholm <https://github.com/kkoopa>
+ * - Trevor Norris <https://github.com/trevnorris>
+ * - Nathan Rajlich <https://github.com/TooTallNate>
+ * - Brett Lawson <https://github.com/brett19>
+ * - Ben Noordhuis <https://github.com/bnoordhuis>
+ *
+ * MIT +no-false-attribs License <https://github.com/rvagg/nan/blob/master/LICENSE>
+ *
+ * Version 1.0.0 (current Node unstable: 0.11.13, Node stable: 0.10.28)
+ *
+ * ChangeLog:
+ * * 1.0.0 May 4 2014
+ * - Heavy API changes for V8 3.25 / Node 0.11.13
+ * - Use cpplint.py
+ * - Removed NanInitPersistent
+ * - Removed NanPersistentToLocal
+ * - Removed NanFromV8String
+ * - Removed NanMakeWeak
+ * - Removed NanNewLocal
+ * - Removed NAN_WEAK_CALLBACK_OBJECT
+ * - Removed NAN_WEAK_CALLBACK_DATA
+ * - Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions
+ * - Introduce NanUndefined, NanNull, NanTrue and NanFalse
+ * - Introduce NanEscapableScope and NanEscapeScope
+ * - Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node)
+ * - Introduce NanMakeCallback for node::MakeCallback
+ * - Introduce NanSetTemplate
+ * - Introduce NanGetCurrentContext
+ * - Introduce NanCompileScript and NanRunScript
+ * - Introduce NanAdjustExternalMemory
+ * - Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback
+ * - Introduce NanGetHeapStatistics
+ * - Rename NanAsyncWorker#SavePersistent() to SaveToPersistent()
+ *
+ * * 0.8.0 Jan 9 2014
+ * - NanDispose -> NanDisposePersistent, deprecate NanDispose
+ * - Extract _NAN_*_RETURN_TYPE, pull up NAN_*()
+ *
+ * * 0.7.1 Jan 9 2014
+ * - Fixes to work against debug builds of Node
+ * - Safer NanPersistentToLocal (avoid reinterpret_cast)
+ * - Speed up common NanRawString case by only extracting flattened string when necessary
+ *
+ * * 0.7.0 Dec 17 2013
+ * - New no-arg form of NanCallback() constructor.
+ * - NanCallback#Call takes Handle rather than Local
+ * - Removed deprecated NanCallback#Run method, use NanCallback#Call instead
+ * - Split off _NAN_*_ARGS_TYPE from _NAN_*_ARGS
+ * - Restore (unofficial) Node 0.6 compatibility at NanCallback#Call()
+ * - Introduce NanRawString() for char* (or appropriate void*) from v8::String
+ * (replacement for NanFromV8String)
+ * - Introduce NanCString() for null-terminated char* from v8::String
+ *
+ * * 0.6.0 Nov 21 2013
+ * - Introduce NanNewLocal<T>(v8::Handle<T> value) for use in place of
+ * v8::Local<T>::New(...) since v8 started requiring isolate in Node 0.11.9
+ *
+ * * 0.5.2 Nov 16 2013
+ * - Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public
+ *
+ * * 0.5.1 Nov 12 2013
+ * - Use node::MakeCallback() instead of direct v8::Function::Call()
+ *
+ * * 0.5.0 Nov 11 2013
+ * - Added @TooTallNate as collaborator
+ * - New, much simpler, "include_dirs" for binding.gyp
+ * - Added full range of NAN_INDEX_* macros to match NAN_PROPERTY_* macros
+ *
+ * * 0.4.4 Nov 2 2013
+ * - Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+
+ *
+ * * 0.4.3 Nov 2 2013
+ * - Include node_object_wrap.h, removed from node.h for Node 0.11.8.
+ *
+ * * 0.4.2 Nov 2 2013
+ * - Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for
+ * Node 0.11.8 release.
+ *
+ * * 0.4.1 Sep 16 2013
+ * - Added explicit `#include <uv.h>` as it was removed from node.h for v0.11.8
+ *
+ * * 0.4.0 Sep 2 2013
+ * - Added NAN_INLINE and NAN_DEPRECATED and made use of them
+ * - Added NanError, NanTypeError and NanRangeError
+ * - Cleaned up code
+ *
+ * * 0.3.2 Aug 30 2013
+ * - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent
+ * in NanAsyncWorker
+ *
+ * * 0.3.1 Aug 20 2013
+ * - fix "not all control paths return a value" compile warning on some platforms
+ *
+ * * 0.3.0 Aug 19 2013
+ * - Made NAN work with NPM
+ * - Lots of fixes to NanFromV8String, pulling in features from new Node core
+ * - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API
+ * - Added optional error number argument for NanThrowError()
+ * - Added NanInitPersistent()
+ * - Added NanReturnNull() and NanReturnEmptyString()
+ * - Added NanLocker and NanUnlocker
+ * - Added missing scopes
+ * - Made sure to clear disposed Persistent handles
+ * - Changed NanAsyncWorker to allocate error messages on the heap
+ * - Changed NanThrowError(Local<Value>) to NanThrowError(Handle<Value>)
+ * - Fixed leak in NanAsyncWorker when errmsg is used
+ *
+ * * 0.2.2 Aug 5 2013
+ * - Fixed usage of undefined variable with node::BASE64 in NanFromV8String()
+ *
+ * * 0.2.1 Aug 5 2013
+ * - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for
+ * NanFromV8String()
+ *
+ * * 0.2.0 Aug 5 2013
+ * - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR,
+ * NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY
+ * - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS,
+ * _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS,
+ * _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS,
+ * _NAN_PROPERTY_QUERY_ARGS
+ * - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer
+ * - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT,
+ * NAN_WEAK_CALLBACK_DATA, NanMakeWeak
+ * - Renamed THROW_ERROR to _NAN_THROW_ERROR
+ * - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*)
+ * - Added NanBufferUse(char*, uint32_t)
+ * - Added NanNewContextHandle(v8::ExtensionConfiguration*,
+ * v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Value>)
+ * - Fixed broken NanCallback#GetFunction()
+ * - Added optional encoding and size arguments to NanFromV8String()
+ * - Added NanGetPointerSafe() and NanSetPointerSafe()
+ * - Added initial test suite (to be expanded)
+ * - Allow NanUInt32OptionValue to convert any Number object
+ *
+ * * 0.1.0 Jul 21 2013
+ * - Added `NAN_GETTER`, `NAN_SETTER`
+ * - Added `NanThrowError` with single Local<Value> argument
+ * - Added `NanNewBufferHandle` with single uint32_t argument
+ * - Added `NanHasInstance(Persistent<FunctionTemplate>&, Handle<Value>)`
+ * - Added `Local<Function> NanCallback#GetFunction()`
+ * - Added `NanCallback#Call(int, Local<Value>[])`
+ * - Deprecated `NanCallback#Run(int, Local<Value>[])` in favour of Call
+ *
+ * See https://github.com/rvagg/nan for the latest update to this file
+ **********************************************************************************/
+
+#ifndef NAN_H_
+#define NAN_H_
+
+#include <uv.h>
+#include <node.h>
+#include <node_buffer.h>
+#include <node_version.h>
+#include <node_object_wrap.h>
+#include <string.h>
+
+#if defined(__GNUC__) && !defined(DEBUG)
+# define NAN_INLINE inline __attribute__((always_inline))
+#elif defined(_MSC_VER) && !defined(DEBUG)
+# define NAN_INLINE __forceinline
+#else
+# define NAN_INLINE inline
+#endif
+
+#if defined(__GNUC__) && !V8_DISABLE_DEPRECATIONS
+# define NAN_DEPRECATED __attribute__((deprecated))
+#elif defined(_MSC_VER) && !V8_DISABLE_DEPRECATIONS
+# define NAN_DEPRECATED __declspec(deprecated)
+#else
+# define NAN_DEPRECATED
+#endif
+
+// some generic helpers
+
+template<typename T> NAN_INLINE bool NanSetPointerSafe(
+ T *var
+ , T val
+) {
+ if (var) {
+ *var = val;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+template<typename T> NAN_INLINE T NanGetPointerSafe(
+ T *var
+ , T fallback = reinterpret_cast<T>(0)
+) {
+ if (var) {
+ return *var;
+ } else {
+ return fallback;
+ }
+}
+
+NAN_INLINE bool NanBooleanOptionValue(
+ v8::Local<v8::Object> optionsObj
+ , v8::Handle<v8::String> opt, bool def
+) {
+ if (def) {
+ return optionsObj.IsEmpty()
+ || !optionsObj->Has(opt)
+ || optionsObj->Get(opt)->BooleanValue();
+ } else {
+ return !optionsObj.IsEmpty()
+ && optionsObj->Has(opt)
+ && optionsObj->Get(opt)->BooleanValue();
+ }
+}
+
+NAN_INLINE bool NanBooleanOptionValue(
+ v8::Local<v8::Object> optionsObj
+ , v8::Handle<v8::String> opt
+) {
+ return NanBooleanOptionValue(optionsObj, opt, false);
+}
+
+NAN_INLINE uint32_t NanUInt32OptionValue(
+ v8::Local<v8::Object> optionsObj
+ , v8::Handle<v8::String> opt
+ , uint32_t def
+) {
+ return !optionsObj.IsEmpty()
+ && optionsObj->Has(opt)
+ && optionsObj->Get(opt)->IsNumber()
+ ? optionsObj->Get(opt)->Uint32Value()
+ : def;
+}
+
+#if (NODE_MODULE_VERSION > 0x000B)
+// Node 0.11+ (0.11.3 and below won't compile with these)
+
+# define _NAN_METHOD_ARGS_TYPE const v8::FunctionCallbackInfo<v8::Value>&
+# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args
+# define _NAN_METHOD_RETURN_TYPE void
+
+# define _NAN_GETTER_ARGS_TYPE const v8::PropertyCallbackInfo<v8::Value>&
+# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args
+# define _NAN_GETTER_RETURN_TYPE void
+
+# define _NAN_SETTER_ARGS_TYPE const v8::PropertyCallbackInfo<void>&
+# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args
+# define _NAN_SETTER_RETURN_TYPE void
+
+# define _NAN_PROPERTY_GETTER_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Value>&
+# define _NAN_PROPERTY_GETTER_ARGS _NAN_PROPERTY_GETTER_ARGS_TYPE args
+# define _NAN_PROPERTY_GETTER_RETURN_TYPE void
+
+# define _NAN_PROPERTY_SETTER_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Value>&
+# define _NAN_PROPERTY_SETTER_ARGS _NAN_PROPERTY_SETTER_ARGS_TYPE args
+# define _NAN_PROPERTY_SETTER_RETURN_TYPE void
+
+# define _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Array>&
+# define _NAN_PROPERTY_ENUMERATOR_ARGS _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE args
+# define _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE void
+
+# define _NAN_PROPERTY_DELETER_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Boolean>&
+# define _NAN_PROPERTY_DELETER_ARGS \
+ _NAN_PROPERTY_DELETER_ARGS_TYPE args
+# define _NAN_PROPERTY_DELETER_RETURN_TYPE void
+
+# define _NAN_PROPERTY_QUERY_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Integer>&
+# define _NAN_PROPERTY_QUERY_ARGS _NAN_PROPERTY_QUERY_ARGS_TYPE args
+# define _NAN_PROPERTY_QUERY_RETURN_TYPE void
+
+# define _NAN_INDEX_GETTER_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Value>&
+# define _NAN_INDEX_GETTER_ARGS _NAN_INDEX_GETTER_ARGS_TYPE args
+# define _NAN_INDEX_GETTER_RETURN_TYPE void
+
+# define _NAN_INDEX_SETTER_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Value>&
+# define _NAN_INDEX_SETTER_ARGS _NAN_INDEX_SETTER_ARGS_TYPE args
+# define _NAN_INDEX_SETTER_RETURN_TYPE void
+
+# define _NAN_INDEX_ENUMERATOR_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Array>&
+# define _NAN_INDEX_ENUMERATOR_ARGS _NAN_INDEX_ENUMERATOR_ARGS_TYPE args
+# define _NAN_INDEX_ENUMERATOR_RETURN_TYPE void
+
+# define _NAN_INDEX_DELETER_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Boolean>&
+# define _NAN_INDEX_DELETER_ARGS _NAN_INDEX_DELETER_ARGS_TYPE args
+# define _NAN_INDEX_DELETER_RETURN_TYPE void
+
+# define _NAN_INDEX_QUERY_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Integer>&
+# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args
+# define _NAN_INDEX_QUERY_RETURN_TYPE void
+
+typedef v8::FunctionCallback NanFunctionCallback;
+static v8::Isolate* nan_isolate = v8::Isolate::GetCurrent();
+
+# define NanUndefined() v8::Undefined(nan_isolate)
+# define NanNull() v8::Null(nan_isolate)
+# define NanTrue() v8::True(nan_isolate)
+# define NanFalse() v8::False(nan_isolate)
+# define NanAdjustExternalMemory(amount) \
+ nan_isolate->AdjustAmountOfExternalAllocatedMemory(amount)
+# define NanSetTemplate(templ, name, value) templ->Set(nan_isolate, name, value)
+# define NanGetCurrentContext() nan_isolate->GetCurrentContext()
+# define NanMakeCallback(target, func, argc, argv) \
+ node::MakeCallback(nan_isolate, target, func, argc, argv)
+# define NanGetInternalFieldPointer(object, index) \
+ object->GetAlignedPointerFromInternalField(index)
+# define NanSetInternalFieldPointer(object, index, value) \
+ object->SetAlignedPointerInInternalField(index, value)
+
+ template<typename T>
+ NAN_INLINE v8::Local<T> NanNew() {
+ return T::New(nan_isolate);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<T> NanNew(P arg1) {
+ return T::New(nan_isolate, arg1);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::Signature> NanNew(
+ v8::Handle<v8::FunctionTemplate> receiver
+ , int argc
+ , v8::Handle<v8::FunctionTemplate> argv[] = 0) {
+ return v8::Signature::New(nan_isolate, receiver, argc, argv);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::FunctionTemplate> NanNew(
+ NanFunctionCallback callback
+ , v8::Handle<v8::Value> data = v8::Handle<v8::Value>()
+ , v8::Handle<v8::Signature> signature = v8::Handle<v8::Signature>()) {
+ return T::New(nan_isolate, callback, data, signature);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<T> NanNew(v8::Handle<T> arg1) {
+ return v8::Local<T>::New(nan_isolate, arg1);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<T> NanNew(const v8::Persistent<T> &arg1) {
+ return v8::Local<T>::New(nan_isolate, arg1);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<T> NanNew(P arg1, int arg2) {
+ return T::New(nan_isolate, arg1, arg2);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Array> NanNew<v8::Array>() {
+ return v8::Array::New(nan_isolate);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Array> NanNew<v8::Array>(int length) {
+ return v8::Array::New(nan_isolate, length);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Date> NanNew<v8::Date>(double time) {
+ return v8::Date::New(nan_isolate, time).As<v8::Date>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Date> NanNew<v8::Date>(int time) {
+ return v8::Date::New(nan_isolate, time).As<v8::Date>();
+ }
+
+ typedef v8::UnboundScript NanUnboundScript;
+ typedef v8::Script NanBoundScript;
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<T> NanNew(
+ P s
+ , const v8::ScriptOrigin& origin
+ ) {
+ v8::ScriptCompiler::Source source(s, origin);
+ return v8::ScriptCompiler::CompileUnbound(nan_isolate, &source);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<NanUnboundScript> NanNew<NanUnboundScript>(
+ v8::Local<v8::String> s
+ ) {
+ v8::ScriptCompiler::Source source(s);
+ return v8::ScriptCompiler::CompileUnbound(nan_isolate, &source);
+ }
+
+ NAN_INLINE v8::Local<v8::String> NanNew(
+ v8::String::ExternalStringResource *resource) {
+ return v8::String::NewExternal(nan_isolate, resource);
+ }
+
+ NAN_INLINE v8::Local<v8::String> NanNew(
+ v8::String::ExternalAsciiStringResource *resource) {
+ return v8::String::NewExternal(nan_isolate, resource);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::BooleanObject> NanNew(bool value) {
+ return v8::BooleanObject::New(value).As<v8::BooleanObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::StringObject>
+ NanNew<v8::StringObject, v8::Local<v8::String> >(
+ v8::Local<v8::String> value) {
+ return v8::StringObject::New(value).As<v8::StringObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::StringObject>
+ NanNew<v8::StringObject, v8::Handle<v8::String> >(
+ v8::Handle<v8::String> value) {
+ return v8::StringObject::New(value).As<v8::StringObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::NumberObject> NanNew<v8::NumberObject>(double val) {
+ return v8::NumberObject::New(nan_isolate, val).As<v8::NumberObject>();
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Handle<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Handle<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Uint32> NanNew<v8::Uint32, int32_t>(int32_t val) {
+ return v8::Uint32::NewFromUnsigned(nan_isolate, val)->ToUint32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Uint32> NanNew<v8::Uint32, uint32_t>(uint32_t val) {
+ return v8::Uint32::NewFromUnsigned(nan_isolate, val)->ToUint32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Int32> NanNew<v8::Int32, int32_t>(int32_t val) {
+ return v8::Int32::New(nan_isolate, val)->ToInt32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Int32> NanNew<v8::Int32, uint32_t>(uint32_t val) {
+ return v8::Int32::New(nan_isolate, val)->ToInt32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, char *>(
+ char *arg
+ , int length) {
+ return v8::String::NewFromUtf8(
+ nan_isolate
+ , arg
+ , v8::String::kNormalString
+ , length);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const char *>(
+ const char *arg
+ , int length) {
+ return v8::String::NewFromUtf8(
+ nan_isolate
+ , arg
+ , v8::String::kNormalString
+ , length);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, char *>(char *arg) {
+ return v8::String::NewFromUtf8(nan_isolate, arg);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const char *>(
+ const char *arg) {
+ return v8::String::NewFromUtf8(nan_isolate, arg);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint8_t *>(
+ uint8_t *arg
+ , int length) {
+ return v8::String::NewFromOneByte(
+ nan_isolate
+ , arg
+ , v8::String::kNormalString
+ , length);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint8_t *>(
+ const uint8_t *arg
+ , int length) {
+ return v8::String::NewFromOneByte(
+ nan_isolate
+ , arg
+ , v8::String::kNormalString
+ , length);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint8_t *>(uint8_t *arg) {
+ return v8::String::NewFromOneByte(nan_isolate, arg);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint8_t *>(
+ const uint8_t *arg) {
+ return v8::String::NewFromOneByte(nan_isolate, arg);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint16_t *>(
+ uint16_t *arg
+ , int length) {
+ return v8::String::NewFromTwoByte(
+ nan_isolate
+ , arg
+ , v8::String::kNormalString
+ , length);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint16_t *>(
+ const uint16_t *arg
+ , int length) {
+ return v8::String::NewFromTwoByte(
+ nan_isolate
+ , arg
+ , v8::String::kNormalString
+ , length);
+ }
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint16_t *>(
+ uint16_t *arg) {
+ return v8::String::NewFromTwoByte(nan_isolate, arg);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint16_t *>(
+ const uint16_t *arg) {
+ return v8::String::NewFromTwoByte(nan_isolate, arg);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String>() {
+ return v8::String::Empty(nan_isolate);
+ }
+
+ NAN_INLINE void NanAddGCEpilogueCallback(
+ v8::Isolate::GCEpilogueCallback callback
+ , v8::GCType gc_type_filter = v8::kGCTypeAll) {
+ nan_isolate->AddGCEpilogueCallback(callback, gc_type_filter);
+ }
+
+ NAN_INLINE void NanRemoveGCEpilogueCallback(
+ v8::Isolate::GCEpilogueCallback callback) {
+ nan_isolate->RemoveGCEpilogueCallback(callback);
+ }
+
+ NAN_INLINE void NanAddGCPrologueCallback(
+ v8::Isolate::GCPrologueCallback callback
+ , v8::GCType gc_type_filter = v8::kGCTypeAll) {
+ nan_isolate->AddGCPrologueCallback(callback, gc_type_filter);
+ }
+
+ NAN_INLINE void NanRemoveGCPrologueCallback(
+ v8::Isolate::GCPrologueCallback callback) {
+ nan_isolate->RemoveGCPrologueCallback(callback);
+ }
+
+ NAN_INLINE void NanGetHeapStatistics(
+ v8::HeapStatistics *heap_statistics) {
+ nan_isolate->GetHeapStatistics(heap_statistics);
+ }
+
+# define NanSymbol(value) NanNew<v8::String>(value)
+
+ template<typename T>
+ NAN_INLINE void NanAssignPersistent(
+ v8::Persistent<T>& handle
+ , v8::Handle<T> obj) {
+ handle.Reset(nan_isolate, obj);
+ }
+
+ template<typename T>
+ NAN_INLINE void NanAssignPersistent(
+ v8::Persistent<T>& handle
+ , const v8::Persistent<T>& obj) {
+ handle.Reset(nan_isolate, obj);
+ }
+
+ template<typename T, typename P>
+ struct _NanWeakCallbackInfo {
+ typedef void (*Callback)(
+ const v8::WeakCallbackData<T, _NanWeakCallbackInfo<T, P> >& data);
+ _NanWeakCallbackInfo(v8::Handle<T> handle, P* param, Callback cb)
+ : parameter(param), callback(cb) {
+ NanAssignPersistent(persistent, handle);
+ }
+
+ ~_NanWeakCallbackInfo() {
+ persistent.Reset();
+ }
+
+ P* const parameter;
+ Callback const callback;
+ v8::Persistent<T> persistent;
+ };
+
+ template<typename T, typename P>
+ class _NanWeakCallbackData {
+ public:
+ _NanWeakCallbackData(_NanWeakCallbackInfo<T, P> *info)
+ : info_(info) { }
+
+ NAN_INLINE v8::Local<T> GetValue() const {
+ return NanNew(info_->persistent);
+ }
+ NAN_INLINE P* GetParameter() const { return info_->parameter; }
+ NAN_INLINE void Revive() const {
+ info_->persistent.SetWeak(info_, info_->callback);
+ }
+
+ NAN_INLINE void Dispose() const {
+ delete info_;
+ }
+
+ private:
+ _NanWeakCallbackInfo<T, P>* info_;
+ };
+
+// do not use for declaration
+# define NAN_WEAK_CALLBACK(name) \
+ template<typename T, typename P> \
+ static void name( \
+ const v8::WeakCallbackData<T, _NanWeakCallbackInfo<T, P> > &data) { \
+ _NanWeakCallbackData<T, P> wcbd( \
+ data.GetParameter()); \
+ _Nan_Weak_Callback_ ## name(wcbd); \
+ } \
+ \
+ template<typename T, typename P> \
+ NAN_INLINE void _Nan_Weak_Callback_ ## name( \
+ const _NanWeakCallbackData<T, P> &data)
+
+# define NanScope() v8::HandleScope scope(nan_isolate)
+# define NanEscapableScope() v8::EscapableHandleScope scope(nan_isolate)
+# define NanEscapeScope(val) scope.Escape(val)
+# define NanLocker() v8::Locker locker(nan_isolate)
+# define NanUnlocker() v8::Unlocker unlocker(nan_isolate)
+# define NanReturnValue(value) return args.GetReturnValue().Set(value)
+# define NanReturnUndefined() return
+# define NanReturnNull() return args.GetReturnValue().SetNull()
+# define NanReturnEmptyString() return args.GetReturnValue().SetEmptyString()
+
+# define NanObjectWrapHandle(obj) obj->handle()
+
+template<typename T, typename P>
+void NAN_INLINE NanMakeWeakPersistent(
+ v8::Handle<T> handle
+ , P* parameter
+ , typename _NanWeakCallbackInfo<T, P>::Callback callback) {
+ _NanWeakCallbackInfo<T, P> *cbinfo =
+ new _NanWeakCallbackInfo<T, P>(handle, parameter, callback);
+ cbinfo->persistent.SetWeak(cbinfo, callback);
+}
+
+# define _NAN_ERROR(fun, errmsg) fun(NanNew<v8::String>(errmsg))
+
+# define _NAN_THROW_ERROR(fun, errmsg) \
+ do { \
+ NanScope(); \
+ nan_isolate->ThrowException(_NAN_ERROR(fun, errmsg)); \
+ } while (0);
+
+ NAN_INLINE v8::Local<v8::Value> NanError(const char* errmsg) {
+ return _NAN_ERROR(v8::Exception::Error, errmsg);
+ }
+
+ NAN_INLINE void NanThrowError(const char* errmsg) {
+ _NAN_THROW_ERROR(v8::Exception::Error, errmsg);
+ }
+
+ NAN_INLINE void NanThrowError(v8::Handle<v8::Value> error) {
+ NanScope();
+ nan_isolate->ThrowException(error);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanError(
+ const char *msg
+ , const int errorNumber
+ ) {
+ v8::Local<v8::Value> err = v8::Exception::Error(NanNew<v8::String>(msg));
+ v8::Local<v8::Object> obj = err.As<v8::Object>();
+ obj->Set(NanSymbol("code"), NanNew<v8::Integer>(errorNumber));
+ return err;
+ }
+
+ NAN_INLINE void NanThrowError(
+ const char *msg
+ , const int errorNumber
+ ) {
+ NanThrowError(NanError(msg, errorNumber));
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanTypeError(const char* errmsg) {
+ return _NAN_ERROR(v8::Exception::TypeError, errmsg);
+ }
+
+ NAN_INLINE void NanThrowTypeError(const char* errmsg) {
+ _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanRangeError(const char* errmsg) {
+ return _NAN_ERROR(v8::Exception::RangeError, errmsg);
+ }
+
+ NAN_INLINE void NanThrowRangeError(const char* errmsg) {
+ _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg);
+ }
+
+ template<typename T> NAN_INLINE void NanDisposePersistent(
+ v8::Persistent<T> &handle
+ ) {
+ handle.Reset();
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (
+ char *data
+ , size_t length
+ , node::smalloc::FreeCallback callback
+ , void *hint
+ ) {
+ return node::Buffer::New(nan_isolate, data, length, callback, hint);
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (
+ const char *data
+ , uint32_t size
+ ) {
+ return node::Buffer::New(nan_isolate, data, size);
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (uint32_t size) {
+ return node::Buffer::New(nan_isolate, size);
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanBufferUse(
+ char* data
+ , uint32_t size
+ ) {
+ return node::Buffer::Use(nan_isolate, data, size);
+ }
+
+ NAN_INLINE bool NanHasInstance(
+ v8::Persistent<v8::FunctionTemplate>& function_template
+ , v8::Handle<v8::Value> value
+ ) {
+ return NanNew(function_template)->HasInstance(value);
+ }
+
+ NAN_INLINE v8::Local<v8::Context> NanNewContextHandle(
+ v8::ExtensionConfiguration* extensions = NULL
+ , v8::Handle<v8::ObjectTemplate> tmpl = v8::Handle<v8::ObjectTemplate>()
+ , v8::Handle<v8::Value> obj = v8::Handle<v8::Value>()
+ ) {
+ return v8::Local<v8::Context>::New(
+ nan_isolate
+ , v8::Context::New(nan_isolate, extensions, tmpl, obj)
+ );
+ }
+
+ NAN_INLINE v8::Local<NanBoundScript> NanCompileScript(
+ v8::Local<v8::String> s
+ , const v8::ScriptOrigin& origin
+ ) {
+ v8::ScriptCompiler::Source source(s, origin);
+ return v8::ScriptCompiler::Compile(nan_isolate, &source);
+ }
+
+ NAN_INLINE v8::Local<NanBoundScript> NanCompileScript(
+ v8::Local<v8::String> s
+ ) {
+ v8::ScriptCompiler::Source source(s);
+ return v8::ScriptCompiler::Compile(nan_isolate, &source);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanRunScript(
+ v8::Local<NanUnboundScript> script
+ ) {
+ return script->BindToCurrentContext()->Run();
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanRunScript(
+ v8::Local<NanBoundScript> script
+ ) {
+ return script->Run();
+ }
+
+#else
+// Node 0.8 and 0.10
+
+# define _NAN_METHOD_ARGS_TYPE const v8::Arguments&
+# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args
+# define _NAN_METHOD_RETURN_TYPE v8::Handle<v8::Value>
+
+# define _NAN_GETTER_ARGS_TYPE const v8::AccessorInfo &
+# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args
+# define _NAN_GETTER_RETURN_TYPE v8::Handle<v8::Value>
+
+# define _NAN_SETTER_ARGS_TYPE const v8::AccessorInfo &
+# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args
+# define _NAN_SETTER_RETURN_TYPE void
+
+# define _NAN_PROPERTY_GETTER_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_PROPERTY_GETTER_ARGS _NAN_PROPERTY_GETTER_ARGS_TYPE args
+# define _NAN_PROPERTY_GETTER_RETURN_TYPE v8::Handle<v8::Value>
+
+# define _NAN_PROPERTY_SETTER_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_PROPERTY_SETTER_ARGS _NAN_PROPERTY_SETTER_ARGS_TYPE args
+# define _NAN_PROPERTY_SETTER_RETURN_TYPE v8::Handle<v8::Value>
+
+# define _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_PROPERTY_ENUMERATOR_ARGS _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE args
+# define _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE v8::Handle<v8::Array>
+
+# define _NAN_PROPERTY_DELETER_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_PROPERTY_DELETER_ARGS _NAN_PROPERTY_DELETER_ARGS_TYPE args
+# define _NAN_PROPERTY_DELETER_RETURN_TYPE v8::Handle<v8::Boolean>
+
+# define _NAN_PROPERTY_QUERY_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_PROPERTY_QUERY_ARGS _NAN_PROPERTY_QUERY_ARGS_TYPE args
+# define _NAN_PROPERTY_QUERY_RETURN_TYPE v8::Handle<v8::Integer>
+
+# define _NAN_INDEX_GETTER_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_INDEX_GETTER_ARGS _NAN_INDEX_GETTER_ARGS_TYPE args
+# define _NAN_INDEX_GETTER_RETURN_TYPE v8::Handle<v8::Value>
+
+# define _NAN_INDEX_SETTER_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_INDEX_SETTER_ARGS _NAN_INDEX_SETTER_ARGS_TYPE args
+# define _NAN_INDEX_SETTER_RETURN_TYPE v8::Handle<v8::Value>
+
+# define _NAN_INDEX_ENUMERATOR_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_INDEX_ENUMERATOR_ARGS _NAN_INDEX_ENUMERATOR_ARGS_TYPE args
+# define _NAN_INDEX_ENUMERATOR_RETURN_TYPE v8::Handle<v8::Array>
+
+# define _NAN_INDEX_DELETER_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_INDEX_DELETER_ARGS _NAN_INDEX_DELETER_ARGS_TYPE args
+# define _NAN_INDEX_DELETER_RETURN_TYPE v8::Handle<v8::Boolean>
+
+# define _NAN_INDEX_QUERY_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args
+# define _NAN_INDEX_QUERY_RETURN_TYPE v8::Handle<v8::Integer>
+
+typedef v8::InvocationCallback NanFunctionCallback;
+
+# define NanUndefined() v8::Undefined()
+# define NanNull() v8::Null()
+# define NanTrue() v8::True()
+# define NanFalse() v8::False()
+# define NanAdjustExternalMemory(amount) \
+ v8::V8::AdjustAmountOfExternalAllocatedMemory(amount)
+# define NanSetTemplate(templ, name, value) templ->Set(name, value)
+# define NanGetCurrentContext() v8::Context::GetCurrent()
+# if NODE_VERSION_AT_LEAST(0, 8, 0)
+# define NanMakeCallback(target, func, argc, argv) \
+ node::MakeCallback(target, func, argc, argv)
+# else
+# define NanMakeCallback(target, func, argc, argv) \
+ do { \
+ v8::TryCatch try_catch; \
+ func->Call(target, argc, argv); \
+ if (try_catch.HasCaught()) { \
+ v8::FatalException(try_catch); \
+ } \
+ } while (0)
+# endif
+
+# define NanSymbol(value) v8::String::NewSymbol(value)
+
+ template<typename T>
+ NAN_INLINE v8::Local<T> NanNew() {
+ return v8::Local<T>::New(T::New());
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<T> NanNew(v8::Handle<T> arg) {
+ return v8::Local<T>::New(arg);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::Signature> NanNew(
+ v8::Handle<v8::FunctionTemplate> receiver
+ , int argc
+ , v8::Handle<v8::FunctionTemplate> argv[] = 0) {
+ return v8::Signature::New(receiver, argc, argv);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::FunctionTemplate> NanNew(
+ NanFunctionCallback callback
+ , v8::Handle<v8::Value> data = v8::Handle<v8::Value>()
+ , v8::Handle<v8::Signature> signature = v8::Handle<v8::Signature>()) {
+ return T::New(callback, data, signature);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<T> NanNew(const v8::Persistent<T> &arg) {
+ return v8::Local<T>::New(arg);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<T> NanNew(P arg) {
+ return v8::Local<T>::New(T::New(arg));
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<T> NanNew(P arg, int length) {
+ return v8::Local<T>::New(T::New(arg, length));
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Handle<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Handle<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Array> NanNew<v8::Array>() {
+ return v8::Array::New();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Array> NanNew<v8::Array>(int length) {
+ return v8::Array::New(length);
+ }
+
+
+ template<>
+ NAN_INLINE v8::Local<v8::Date> NanNew<v8::Date>(double time) {
+ return v8::Date::New(time).As<v8::Date>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Date> NanNew<v8::Date>(int time) {
+ return v8::Date::New(time).As<v8::Date>();
+ }
+
+ typedef v8::Script NanUnboundScript;
+ typedef v8::Script NanBoundScript;
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<T> NanNew(
+ P s
+ , const v8::ScriptOrigin& origin
+ ) {
+ return v8::Script::New(s, const_cast<v8::ScriptOrigin *>(&origin));
+ }
+
+ template<>
+ NAN_INLINE v8::Local<NanUnboundScript> NanNew<NanUnboundScript>(
+ v8::Local<v8::String> s
+ ) {
+ return v8::Script::New(s);
+ }
+
+ NAN_INLINE v8::Local<v8::String> NanNew(
+ v8::String::ExternalStringResource *resource) {
+ return v8::String::NewExternal(resource);
+ }
+
+ NAN_INLINE v8::Local<v8::String> NanNew(
+ v8::String::ExternalAsciiStringResource *resource) {
+ return v8::String::NewExternal(resource);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::BooleanObject> NanNew(bool value) {
+ return v8::BooleanObject::New(value).As<v8::BooleanObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::StringObject>
+ NanNew<v8::StringObject, v8::Local<v8::String> >(
+ v8::Local<v8::String> value) {
+ return v8::StringObject::New(value).As<v8::StringObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::StringObject>
+ NanNew<v8::StringObject, v8::Handle<v8::String> >(
+ v8::Handle<v8::String> value) {
+ return v8::StringObject::New(value).As<v8::StringObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::NumberObject> NanNew<v8::NumberObject>(double val) {
+ return v8::NumberObject::New(val).As<v8::NumberObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Uint32> NanNew<v8::Uint32, int32_t>(int32_t val) {
+ return v8::Uint32::NewFromUnsigned(val)->ToUint32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Uint32> NanNew<v8::Uint32, uint32_t>(uint32_t val) {
+ return v8::Uint32::NewFromUnsigned(val)->ToUint32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Int32> NanNew<v8::Int32, int32_t>(int32_t val) {
+ return v8::Int32::New(val)->ToInt32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Int32> NanNew<v8::Int32, uint32_t>(uint32_t val) {
+ return v8::Int32::New(val)->ToInt32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint8_t *>(
+ uint8_t *arg
+ , int length) {
+ uint16_t *warg = new uint16_t[length];
+ for (int i = 0; i < length; i++) {
+ warg[i] = arg[i];
+ }
+ v8::Local<v8::String> retval = v8::String::New(warg, length);
+ delete[] warg;
+ return retval;
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint8_t *>(
+ const uint8_t *arg
+ , int length) {
+ uint16_t *warg = new uint16_t[length];
+ for (int i = 0; i < length; i++) {
+ warg[i] = arg[i];
+ }
+ v8::Local<v8::String> retval = v8::String::New(warg, length);
+ delete[] warg;
+ return retval;
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint8_t *>(uint8_t *arg) {
+ int length = strlen(reinterpret_cast<char *>(arg));
+ uint16_t *warg = new uint16_t[length];
+ for (int i = 0; i < length; i++) {
+ warg[i] = arg[i];
+ }
+
+ v8::Local<v8::String> retval = v8::String::New(warg, length);
+ delete[] warg;
+ return retval;
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint8_t *>(
+ const uint8_t *arg) {
+ int length = strlen(reinterpret_cast<const char *>(arg));
+ uint16_t *warg = new uint16_t[length];
+ for (int i = 0; i < length; i++) {
+ warg[i] = arg[i];
+ }
+ v8::Local<v8::String> retval = v8::String::New(warg, length);
+ delete[] warg;
+ return retval;
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String>() {
+ return v8::String::Empty();
+ }
+
+ NAN_INLINE void NanAddGCEpilogueCallback(
+ v8::GCEpilogueCallback callback
+ , v8::GCType gc_type_filter = v8::kGCTypeAll) {
+ v8::V8::AddGCEpilogueCallback(callback, gc_type_filter);
+ }
+ NAN_INLINE void NanRemoveGCEpilogueCallback(
+ v8::GCEpilogueCallback callback) {
+ v8::V8::RemoveGCEpilogueCallback(callback);
+ }
+ NAN_INLINE void NanAddGCPrologueCallback(
+ v8::GCPrologueCallback callback
+ , v8::GCType gc_type_filter = v8::kGCTypeAll) {
+ v8::V8::AddGCPrologueCallback(callback, gc_type_filter);
+ }
+ NAN_INLINE void NanRemoveGCPrologueCallback(
+ v8::GCPrologueCallback callback) {
+ v8::V8::RemoveGCPrologueCallback(callback);
+ }
+ NAN_INLINE void NanGetHeapStatistics(
+ v8::HeapStatistics *heap_statistics) {
+ v8::V8::GetHeapStatistics(heap_statistics);
+ }
+
+ template<typename T>
+ NAN_INLINE void NanAssignPersistent(
+ v8::Persistent<T>& handle
+ , v8::Handle<T> obj) {
+ handle.Dispose();
+ handle = v8::Persistent<T>::New(obj);
+ }
+
+ template<typename T, typename P>
+ struct _NanWeakCallbackInfo {
+ typedef void (*Callback)(v8::Persistent<v8::Value> object, void* parameter);
+ _NanWeakCallbackInfo(v8::Handle<T> handle, P* param, Callback cb) :
+ parameter(param)
+ , callback(cb)
+ , persistent(v8::Persistent<T>::New(handle)) { }
+
+ ~_NanWeakCallbackInfo() {
+ persistent.Dispose();
+ persistent.Clear();
+ }
+
+ P* const parameter;
+ Callback const callback;
+ v8::Persistent<T> persistent;
+ };
+
+ template<typename T, typename P>
+ class _NanWeakCallbackData {
+ public:
+ _NanWeakCallbackData(_NanWeakCallbackInfo<T, P> *info)
+ : info_(info) { }
+
+ NAN_INLINE v8::Local<T> GetValue() const {
+ return NanNew(info_->persistent);
+ }
+ NAN_INLINE P* GetParameter() const { return info_->parameter; }
+ NAN_INLINE void Revive() const {
+ info_->persistent.MakeWeak(info_, info_->callback);
+ }
+ NAN_INLINE void Dispose() const {
+ delete info_;
+ }
+
+ private:
+ _NanWeakCallbackInfo<T, P>* info_;
+ };
+
+# define NanGetInternalFieldPointer(object, index) \
+ object->GetPointerFromInternalField(index)
+# define NanSetInternalFieldPointer(object, index, value) \
+ object->SetPointerInInternalField(index, value)
+
+// do not use for declaration
+# define NAN_WEAK_CALLBACK(name) \
+ template<typename T, typename P> \
+ static void name( \
+ v8::Persistent<v8::Value> object, void *data) { \
+ _NanWeakCallbackData<T, P> wcbd( \
+ static_cast<_NanWeakCallbackInfo<T, P>*>(data)); \
+ _Nan_Weak_Callback_ ## name(wcbd); \
+ } \
+ \
+ template<typename T, typename P> \
+ NAN_INLINE void _Nan_Weak_Callback_ ## name( \
+ const _NanWeakCallbackData<T, P> &data)
+
+ template<typename T, typename P>
+ NAN_INLINE void NanMakeWeakPersistent(
+ v8::Handle<T> handle
+ , P* parameter
+ , typename _NanWeakCallbackInfo<T, P>::Callback callback) {
+ _NanWeakCallbackInfo<T, P> *cbinfo =
+ new _NanWeakCallbackInfo<T, P>(handle, parameter, callback);
+ cbinfo->persistent.MakeWeak(cbinfo, callback);
+ }
+
+# define NanScope() v8::HandleScope scope
+# define NanEscapableScope() v8::HandleScope scope
+# define NanEscapeScope(val) scope.Close(val)
+# define NanLocker() v8::Locker locker
+# define NanUnlocker() v8::Unlocker unlocker
+# define NanReturnValue(value) return scope.Close(value)
+# define NanReturnUndefined() return v8::Undefined()
+# define NanReturnNull() return v8::Null()
+# define NanReturnEmptyString() return v8::String::Empty()
+# define NanObjectWrapHandle(obj) v8::Local<v8::Object>::New(obj->handle_)
+
+# define _NAN_ERROR(fun, errmsg) \
+ fun(v8::String::New(errmsg))
+
+# define _NAN_THROW_ERROR(fun, errmsg) \
+ do { \
+ NanScope(); \
+ return v8::Local<v8::Value>::New( \
+ v8::ThrowException(_NAN_ERROR(fun, errmsg))); \
+ } while (0);
+
+ NAN_INLINE v8::Local<v8::Value> NanError(const char* errmsg) {
+ return _NAN_ERROR(v8::Exception::Error, errmsg);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanThrowError(const char* errmsg) {
+ _NAN_THROW_ERROR(v8::Exception::Error, errmsg);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanThrowError(
+ v8::Handle<v8::Value> error
+ ) {
+ NanScope();
+ return v8::Local<v8::Value>::New(v8::ThrowException(error));
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanError(
+ const char *msg
+ , const int errorNumber
+ ) {
+ v8::Local<v8::Value> err = v8::Exception::Error(v8::String::New(msg));
+ v8::Local<v8::Object> obj = err.As<v8::Object>();
+ obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber));
+ return err;
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanThrowError(
+ const char *msg
+ , const int errorNumber
+ ) {
+ return NanThrowError(NanError(msg, errorNumber));
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanTypeError(const char* errmsg) {
+ return _NAN_ERROR(v8::Exception::TypeError, errmsg);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanThrowTypeError(
+ const char* errmsg
+ ) {
+ _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanRangeError(
+ const char* errmsg
+ ) {
+ return _NAN_ERROR(v8::Exception::RangeError, errmsg);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanThrowRangeError(
+ const char* errmsg
+ ) {
+ _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg);
+ }
+
+ template<typename T>
+ NAN_INLINE void NanDisposePersistent(
+ v8::Persistent<T> &handle) { // NOLINT(runtime/references)
+ handle.Dispose();
+ handle.Clear();
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (
+ char *data
+ , size_t length
+ , node::Buffer::free_callback callback
+ , void *hint
+ ) {
+ return NanNew<v8::Object>(
+ node::Buffer::New(data, length, callback, hint)->handle_);
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (
+ const char *data
+ , uint32_t size
+ ) {
+#if NODE_MODULE_VERSION >= 0x000B
+ return NanNew<v8::Object>(node::Buffer::New(data, size)->handle_);
+#else
+ return NanNew<v8::Object>(
+ node::Buffer::New(const_cast<char*>(data), size)->handle_);
+#endif
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (uint32_t size) {
+ return NanNew<v8::Object>(node::Buffer::New(size)->handle_);
+ }
+
+ NAN_INLINE void FreeData(char *data, void *hint) {
+ delete[] data;
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanBufferUse(
+ char* data
+ , uint32_t size
+ ) {
+ return NanNew<v8::Object>(
+ node::Buffer::New(data, size, FreeData, NULL)->handle_);
+ }
+
+ NAN_INLINE bool NanHasInstance(
+ v8::Persistent<v8::FunctionTemplate>& function_template
+ , v8::Handle<v8::Value> value
+ ) {
+ return function_template->HasInstance(value);
+ }
+
+ NAN_INLINE v8::Local<v8::Context> NanNewContextHandle(
+ v8::ExtensionConfiguration* extensions = NULL
+ , v8::Handle<v8::ObjectTemplate> tmpl = v8::Handle<v8::ObjectTemplate>()
+ , v8::Handle<v8::Value> obj = v8::Handle<v8::Value>()
+ ) {
+ v8::Persistent<v8::Context> ctx = v8::Context::New(extensions, tmpl, obj);
+ v8::Local<v8::Context> lctx = NanNew<v8::Context>(ctx);
+ ctx.Dispose();
+ return lctx;
+ }
+
+ NAN_INLINE v8::Local<NanBoundScript> NanCompileScript(
+ v8::Local<v8::String> s
+ , const v8::ScriptOrigin& origin
+ ) {
+ return v8::Script::Compile(s, const_cast<v8::ScriptOrigin *>(&origin));
+ }
+
+ NAN_INLINE v8::Local<NanBoundScript> NanCompileScript(
+ v8::Local<v8::String> s
+ ) {
+ return v8::Script::Compile(s);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanRunScript(v8::Local<v8::Script> script) {
+ return script->Run();
+ }
+
+#endif // NODE_MODULE_VERSION
+
+typedef void (*NanFreeCallback)(char *data, void *hint);
+
+#define NAN_METHOD(name) _NAN_METHOD_RETURN_TYPE name(_NAN_METHOD_ARGS)
+#define NAN_GETTER(name) \
+ _NAN_GETTER_RETURN_TYPE name( \
+ v8::Local<v8::String> property \
+ , _NAN_GETTER_ARGS)
+#define NAN_SETTER(name) \
+ _NAN_SETTER_RETURN_TYPE name( \
+ v8::Local<v8::String> property \
+ , v8::Local<v8::Value> value \
+ , _NAN_SETTER_ARGS)
+#define NAN_PROPERTY_GETTER(name) \
+ _NAN_PROPERTY_GETTER_RETURN_TYPE name( \
+ v8::Local<v8::String> property \
+ , _NAN_PROPERTY_GETTER_ARGS)
+#define NAN_PROPERTY_SETTER(name) \
+ _NAN_PROPERTY_SETTER_RETURN_TYPE name( \
+ v8::Local<v8::String> property \
+ , v8::Local<v8::Value> value \
+ , _NAN_PROPERTY_SETTER_ARGS)
+#define NAN_PROPERTY_ENUMERATOR(name) \
+ _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE name(_NAN_PROPERTY_ENUMERATOR_ARGS)
+#define NAN_PROPERTY_DELETER(name) \
+ _NAN_PROPERTY_DELETER_RETURN_TYPE name( \
+ v8::Local<v8::String> property \
+ , _NAN_PROPERTY_DELETER_ARGS)
+#define NAN_PROPERTY_QUERY(name) \
+ _NAN_PROPERTY_QUERY_RETURN_TYPE name( \
+ v8::Local<v8::String> property \
+ , _NAN_PROPERTY_QUERY_ARGS)
+# define NAN_INDEX_GETTER(name) \
+ _NAN_INDEX_GETTER_RETURN_TYPE name(uint32_t index, _NAN_INDEX_GETTER_ARGS)
+#define NAN_INDEX_SETTER(name) \
+ _NAN_INDEX_SETTER_RETURN_TYPE name( \
+ uint32_t index \
+ , v8::Local<v8::Value> value \
+ , _NAN_INDEX_SETTER_ARGS)
+#define NAN_INDEX_ENUMERATOR(name) \
+ _NAN_INDEX_ENUMERATOR_RETURN_TYPE name(_NAN_INDEX_ENUMERATOR_ARGS)
+#define NAN_INDEX_DELETER(name) \
+ _NAN_INDEX_DELETER_RETURN_TYPE name( \
+ uint32_t index \
+ , _NAN_INDEX_DELETER_ARGS)
+#define NAN_INDEX_QUERY(name) \
+ _NAN_INDEX_QUERY_RETURN_TYPE name(uint32_t index, _NAN_INDEX_QUERY_ARGS)
+
+class NanCallback {
+ public:
+ NanCallback() {
+ NanScope();
+ v8::Local<v8::Object> obj = NanNew<v8::Object>();
+ NanAssignPersistent(handle, obj);
+ }
+
+ explicit NanCallback(const v8::Handle<v8::Function> &fn) {
+ NanScope();
+ v8::Local<v8::Object> obj = NanNew<v8::Object>();
+ NanAssignPersistent(handle, obj);
+ SetFunction(fn);
+ }
+
+ ~NanCallback() {
+ if (handle.IsEmpty()) return;
+ NanDisposePersistent(handle);
+ }
+
+ NAN_INLINE void SetFunction(const v8::Handle<v8::Function> &fn) {
+ NanScope();
+ NanNew(handle)->Set(NanSymbol("callback"), fn);
+ }
+
+ NAN_INLINE v8::Local<v8::Function> GetFunction () {
+ return NanNew(handle)->Get(NanSymbol("callback"))
+ .As<v8::Function>();
+ }
+
+ void Call(int argc, v8::Handle<v8::Value> argv[]) {
+ NanScope();
+#if (NODE_MODULE_VERSION > 0x000B) // 0.11.12+
+ v8::Local<v8::Function> callback = NanNew(handle)->
+ Get(NanSymbol("callback")).As<v8::Function>();
+ node::MakeCallback(
+ nan_isolate
+ , nan_isolate->GetCurrentContext()->Global()
+ , callback
+ , argc
+ , argv
+ );
+#else
+#if NODE_VERSION_AT_LEAST(0, 8, 0)
+ v8::Local<v8::Function> callback = NanNew(handle)->
+ Get(NanSymbol("callback")).As<v8::Function>();
+ node::MakeCallback(
+ v8::Context::GetCurrent()->Global()
+ , callback
+ , argc
+ , argv
+ );
+#else
+ node::MakeCallback(handle, "callback", argc, argv);
+#endif
+#endif
+ }
+
+ private:
+ v8::Persistent<v8::Object> handle;
+};
+
+/* abstract */ class NanAsyncWorker {
+ public:
+ explicit NanAsyncWorker(NanCallback *callback) : callback(callback) {
+ request.data = this;
+ errmsg = NULL;
+
+ NanScope();
+ v8::Local<v8::Object> obj = NanNew<v8::Object>();
+ NanAssignPersistent(persistentHandle, obj);
+ }
+
+ virtual ~NanAsyncWorker() {
+ NanScope();
+
+ if (!persistentHandle.IsEmpty())
+ NanDisposePersistent(persistentHandle);
+ if (callback)
+ delete callback;
+ if (errmsg)
+ delete errmsg;
+ }
+
+ virtual void WorkComplete() {
+ NanScope();
+
+ if (errmsg == NULL)
+ HandleOKCallback();
+ else
+ HandleErrorCallback();
+ delete callback;
+ callback = NULL;
+ }
+
+ NAN_INLINE void SaveToPersistent(const char *key, v8::Local<v8::Object> &obj) {
+ v8::Local<v8::Object> handle = NanNew(persistentHandle);
+ handle->Set(NanSymbol(key), obj);
+ }
+
+ v8::Local<v8::Object> GetFromPersistent(const char *key) {
+ NanEscapableScope();
+ v8::Local<v8::Object> handle = NanNew(persistentHandle);
+ return NanEscapeScope(handle->Get(NanSymbol(key)).As<v8::Object>());
+ }
+
+ virtual void Execute() = 0;
+
+ uv_work_t request;
+
+ protected:
+ v8::Persistent<v8::Object> persistentHandle;
+ NanCallback *callback;
+ const char *errmsg;
+
+ virtual void HandleOKCallback() {
+ NanScope();
+
+ callback->Call(0, NULL);
+ }
+
+ virtual void HandleErrorCallback() {
+ NanScope();
+
+ v8::Local<v8::Value> argv[] = {
+ v8::Exception::Error(NanNew<v8::String>(errmsg))
+ };
+ callback->Call(1, argv);
+ }
+};
+
+NAN_INLINE void NanAsyncExecute (uv_work_t* req) {
+ NanAsyncWorker *worker = static_cast<NanAsyncWorker*>(req->data);
+ worker->Execute();
+}
+
+NAN_INLINE void NanAsyncExecuteComplete (uv_work_t* req) {
+ NanAsyncWorker* worker = static_cast<NanAsyncWorker*>(req->data);
+ worker->WorkComplete();
+ delete worker;
+}
+
+NAN_INLINE void NanAsyncQueueWorker (NanAsyncWorker* worker) {
+ uv_queue_work(
+ uv_default_loop()
+ , &worker->request
+ , NanAsyncExecute
+ , (uv_after_work_cb)NanAsyncExecuteComplete
+ );
+}
+
+//// Base 64 ////
+
+#define _nan_base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4)
+
+// Doesn't check for padding at the end. Can be 1-2 bytes over.
+NAN_INLINE size_t _nan_base64_decoded_size_fast(size_t size) {
+ size_t remainder = size % 4;
+
+ size = (size / 4) * 3;
+ if (remainder) {
+ if (size == 0 && remainder == 1) {
+ // special case: 1-byte input cannot be decoded
+ size = 0;
+ } else {
+ // non-padded input, add 1 or 2 extra bytes
+ size += 1 + (remainder == 3);
+ }
+ }
+
+ return size;
+}
+
+template<typename T>
+NAN_INLINE size_t _nan_base64_decoded_size(
+ const T* src
+ , size_t size
+) {
+ if (size == 0)
+ return 0;
+
+ if (src[size - 1] == '=')
+ size--;
+ if (size > 0 && src[size - 1] == '=')
+ size--;
+
+ return _nan_base64_decoded_size_fast(size);
+}
+
+// supports regular and URL-safe base64
+static const int _nan_unbase64_table[] = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, 62, -1, 63
+ , 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1
+ , -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
+ , 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, 63
+ , -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40
+ , 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+};
+
+#define _nan_unbase64(x) _nan_unbase64_table[(uint8_t)(x)]
+
+template<typename T> static size_t _nan_base64_decode(
+ char* buf
+ , size_t len
+ , const T* src
+ , const size_t srcLen
+) {
+ char* dst = buf;
+ char* dstEnd = buf + len;
+ const T* srcEnd = src + srcLen;
+
+ while (src < srcEnd && dst < dstEnd) {
+ ptrdiff_t remaining = srcEnd - src;
+ char a, b, c, d;
+
+ while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
+ if (remaining == 0 || *src == '=') break;
+ a = _nan_unbase64(*src++);
+
+ while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
+ if (remaining <= 1 || *src == '=') break;
+ b = _nan_unbase64(*src++);
+
+ *dst++ = (a << 2) | ((b & 0x30) >> 4);
+ if (dst == dstEnd) break;
+
+ while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
+ if (remaining <= 2 || *src == '=') break;
+ c = _nan_unbase64(*src++);
+
+ *dst++ = ((b & 0x0F) << 4) | ((c & 0x3C) >> 2);
+ if (dst == dstEnd) break;
+
+ while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
+ if (remaining <= 3 || *src == '=') break;
+ d = _nan_unbase64(*src++);
+
+ *dst++ = ((c & 0x03) << 6) | (d & 0x3F);
+ }
+
+ return dst - buf;
+}
+
+//// HEX ////
+
+template<typename T> unsigned _nan_hex2bin(T c) {
+ if (c >= '0' && c <= '9') return c - '0';
+ if (c >= 'A' && c <= 'F') return 10 + (c - 'A');
+ if (c >= 'a' && c <= 'f') return 10 + (c - 'a');
+ return static_cast<unsigned>(-1);
+}
+
+template<typename T> static size_t _nan_hex_decode(
+ char* buf
+ , size_t len
+ , const T* src
+ , const size_t srcLen
+) {
+ size_t i;
+ for (i = 0; i < len && i * 2 + 1 < srcLen; ++i) {
+ unsigned a = _nan_hex2bin(src[i * 2 + 0]);
+ unsigned b = _nan_hex2bin(src[i * 2 + 1]);
+ if (!~a || !~b) return i;
+ buf[i] = a * 16 + b;
+ }
+
+ return i;
+}
+
+static bool _NanGetExternalParts(
+ v8::Handle<v8::Value> val
+ , const char** data
+ , size_t* len
+) {
+ if (node::Buffer::HasInstance(val)) {
+ *data = node::Buffer::Data(val.As<v8::Object>());
+ *len = node::Buffer::Length(val.As<v8::Object>());
+ return true;
+ }
+
+ assert(val->IsString());
+ v8::Local<v8::String> str = NanNew<v8::String>(val.As<v8::String>());
+
+ if (str->IsExternalAscii()) {
+ const v8::String::ExternalAsciiStringResource* ext;
+ ext = str->GetExternalAsciiStringResource();
+ *data = ext->data();
+ *len = ext->length();
+ return true;
+
+ } else if (str->IsExternal()) {
+ const v8::String::ExternalStringResource* ext;
+ ext = str->GetExternalStringResource();
+ *data = reinterpret_cast<const char*>(ext->data());
+ *len = ext->length();
+ return true;
+ }
+
+ return false;
+}
+
+namespace Nan {
+ enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER};
+}
+
+NAN_INLINE void* NanRawString(
+ v8::Handle<v8::Value> from
+ , enum Nan::Encoding encoding
+ , size_t *datalen
+ , void *buf
+ , size_t buflen
+ , int flags
+) {
+ NanScope();
+
+ size_t sz_;
+ size_t term_len = !(flags & v8::String::NO_NULL_TERMINATION);
+ char *data = NULL;
+ size_t len;
+ bool is_extern = _NanGetExternalParts(
+ from
+ , const_cast<const char**>(&data)
+ , &len);
+
+ if (is_extern && !term_len) {
+ NanSetPointerSafe(datalen, len);
+ return data;
+ }
+
+ v8::Local<v8::String> toStr = from->ToString();
+
+ char *to = static_cast<char *>(buf);
+
+ switch (encoding) {
+ case Nan::ASCII:
+#if NODE_MODULE_VERSION < 0x000C
+ sz_ = toStr->Length();
+ if (to == NULL) {
+ to = new char[sz_ + term_len];
+ } else {
+ assert(buflen >= sz_ + term_len && "too small buffer");
+ }
+ NanSetPointerSafe<size_t>(
+ datalen
+ , toStr->WriteAscii(to, 0, static_cast<int>(sz_ + term_len), flags));
+ return to;
+#endif
+ case Nan::BINARY:
+ case Nan::BUFFER:
+ sz_ = toStr->Length();
+ if (to == NULL) {
+ to = new char[sz_ + term_len];
+ } else {
+ assert(buflen >= sz_ + term_len && "too small buffer");
+ }
+#if NODE_MODULE_VERSION < 0x000C
+ {
+ uint16_t* twobytebuf = new uint16_t[sz_ + term_len];
+
+ size_t len = toStr->Write(twobytebuf, 0,
+ static_cast<int>(sz_ + term_len), flags);
+
+ for (size_t i = 0; i < sz_ + term_len && i < len + term_len; i++) {
+ unsigned char *b = reinterpret_cast<unsigned char*>(&twobytebuf[i]);
+ to[i] = *b;
+ }
+
+ NanSetPointerSafe<size_t>(datalen, len);
+
+ delete[] twobytebuf;
+ return to;
+ }
+#else
+ NanSetPointerSafe<size_t>(
+ datalen,
+ toStr->WriteOneByte(
+ reinterpret_cast<uint8_t *>(to)
+ , 0
+ , static_cast<int>(sz_ + term_len)
+ , flags));
+ return to;
+#endif
+ case Nan::UTF8:
+ sz_ = toStr->Utf8Length();
+ if (to == NULL) {
+ to = new char[sz_ + term_len];
+ } else {
+ assert(buflen >= sz_ + term_len && "too small buffer");
+ }
+ NanSetPointerSafe<size_t>(
+ datalen
+ , toStr->WriteUtf8(to, static_cast<int>(sz_ + term_len)
+ , NULL, flags)
+ - term_len);
+ return to;
+ case Nan::BASE64:
+ {
+ v8::String::Value value(toStr);
+ sz_ = _nan_base64_decoded_size(*value, value.length());
+ if (to == NULL) {
+ to = new char[sz_ + term_len];
+ } else {
+ assert(buflen >= sz_ + term_len);
+ }
+ NanSetPointerSafe<size_t>(
+ datalen
+ , _nan_base64_decode(to, sz_, *value, value.length()));
+ if (term_len) {
+ to[sz_] = '\0';
+ }
+ return to;
+ }
+ case Nan::UCS2:
+ {
+ sz_ = toStr->Length();
+ if (to == NULL) {
+ to = new char[(sz_ + term_len) * 2];
+ } else {
+ assert(buflen >= (sz_ + term_len) * 2 && "too small buffer");
+ }
+
+ int bc = 2 * toStr->Write(
+ reinterpret_cast<uint16_t *>(to)
+ , 0
+ , static_cast<int>(sz_ + term_len)
+ , flags);
+ NanSetPointerSafe<size_t>(datalen, bc);
+ return to;
+ }
+ case Nan::HEX:
+ {
+ v8::String::Value value(toStr);
+ sz_ = value.length();
+ assert(!(sz_ & 1) && "bad hex data");
+ if (to == NULL) {
+ to = new char[sz_ / 2 + term_len];
+ } else {
+ assert(buflen >= sz_ / 2 + term_len && "too small buffer");
+ }
+ NanSetPointerSafe<size_t>(
+ datalen
+ , _nan_hex_decode(to, sz_ / 2, *value, value.length()));
+ }
+ if (term_len) {
+ to[sz_ / 2] = '\0';
+ }
+ return to;
+ default:
+ assert(0 && "unknown encoding");
+ }
+ return to;
+}
+
+NAN_INLINE char* NanCString(
+ v8::Handle<v8::Value> from
+ , size_t *datalen
+ , char *buf = NULL
+ , size_t buflen = 0
+ , int flags = v8::String::NO_OPTIONS
+) {
+ return static_cast<char *>(
+ NanRawString(from, Nan::UTF8, datalen, buf, buflen, flags)
+ );
+}
+
+#endif // NAN_H_
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/package.json b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/package.json
new file mode 100644
index 0000000..cae1811
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/package.json
@@ -0,0 +1,67 @@
+{
+ "name": "nan",
+ "version": "1.0.0",
+ "description": "Native Abstractions for Node.js: C++ header for Node 0.8->0.12 compatibility",
+ "main": "include_dirs.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/rvagg/nan.git"
+ },
+ "contributors": [
+ {
+ "name": "Rod Vagg",
+ "email": "r@va.gg",
+ "url": "https://github.com/rvagg"
+ },
+ {
+ "name": "Benjamin Byholm",
+ "email": "bbyholm@abo.fi",
+ "url": "https://github.com/kkoopa/"
+ },
+ {
+ "name": "Trevor Norris",
+ "email": "trev.norris@gmail.com",
+ "url": "https://github.com/trevnorris"
+ },
+ {
+ "name": "Nathan Rajlich",
+ "email": "nathan@tootallnate.net",
+ "url": "https://github.com/TooTallNate"
+ },
+ {
+ "name": "Brett Lawson",
+ "email": "brett19@gmail.com",
+ "url": "https://github.com/brett19"
+ },
+ {
+ "name": "Ben Noordhuis",
+ "email": "info@bnoordhuis.nl",
+ "url": "https://github.com/bnoordhuis"
+ }
+ ],
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/rvagg/nan/issues"
+ },
+ "homepage": "https://github.com/rvagg/nan",
+ "_id": "nan@1.0.0",
+ "dist": {
+ "shasum": "ae24f8850818d662fcab5acf7f3b95bfaa2ccf38",
+ "tarball": "http://registry.npmjs.org/nan/-/nan-1.0.0.tgz"
+ },
+ "_from": "nan@~1.0.0",
+ "_npmVersion": "1.4.3",
+ "_npmUser": {
+ "name": "rvagg",
+ "email": "rod@vagg.org"
+ },
+ "maintainers": [
+ {
+ "name": "rvagg",
+ "email": "rod@vagg.org"
+ }
+ ],
+ "directories": {},
+ "_shasum": "ae24f8850818d662fcab5acf7f3b95bfaa2ccf38",
+ "_resolved": "https://registry.npmjs.org/nan/-/nan-1.0.0.tgz"
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/.npmignore b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/.npmignore
new file mode 100644
index 0000000..1b18fb3
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/.npmignore
@@ -0,0 +1,7 @@
+npm-debug.log
+node_modules
+.*.swp
+.lock-*
+build/
+
+test
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/Makefile b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/Makefile
new file mode 100644
index 0000000..7496b6f
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/Makefile
@@ -0,0 +1,12 @@
+ALL_TESTS = $(shell find test/ -name '*.test.js')
+
+run-tests:
+ @./node_modules/.bin/mocha \
+ -t 2000 \
+ $(TESTFLAGS) \
+ $(TESTS)
+
+test:
+ @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests
+
+.PHONY: test
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/README.md b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/README.md
new file mode 100644
index 0000000..0dabc75
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/README.md
@@ -0,0 +1,69 @@
+# options.js #
+
+A very light-weight in-code option parsers for node.js.
+
+## Usage ##
+
+``` js
+var Options = require("options");
+
+// Create an Options object
+function foo(options) {
+ var default_options = {
+ foo : "bar"
+ };
+
+ // Create an option object with default value
+ var opts = new Options(default_options);
+
+ // Merge options
+ opts = opts.merge(options);
+
+ // Reset to default value
+ opts.reset();
+
+ // Copy selected attributes out
+ var seled_att = opts.copy("foo");
+
+ // Read json options from a file.
+ opts.read("options.file"); // Sync
+ opts.read("options.file", function(err){ // Async
+ if(err){ // If error occurs
+ console.log("File error.");
+ }else{
+ // No error
+ }
+ });
+
+ // Attributes defined or not
+ opts.isDefinedAndNonNull("foobar");
+ opts.isDefined("foobar");
+}
+
+```
+
+
+## License ##
+
+(The MIT License)
+
+Copyright (c) 2012 Einar Otto Stangvik &lt;einaros@gmail.com&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/lib/options.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/lib/options.js
new file mode 100644
index 0000000..4fc45e9
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/lib/options.js
@@ -0,0 +1,86 @@
+/*!
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var fs = require('fs');
+
+function Options(defaults) {
+ var internalValues = {};
+ var values = this.value = {};
+ Object.keys(defaults).forEach(function(key) {
+ internalValues[key] = defaults[key];
+ Object.defineProperty(values, key, {
+ get: function() { return internalValues[key]; },
+ configurable: false,
+ enumerable: true
+ });
+ });
+ this.reset = function() {
+ Object.keys(defaults).forEach(function(key) {
+ internalValues[key] = defaults[key];
+ });
+ return this;
+ };
+ this.merge = function(options, required) {
+ options = options || {};
+ if (Object.prototype.toString.call(required) === '[object Array]') {
+ var missing = [];
+ for (var i = 0, l = required.length; i < l; ++i) {
+ var key = required[i];
+ if (!(key in options)) {
+ missing.push(key);
+ }
+ }
+ if (missing.length > 0) {
+ if (missing.length > 1) {
+ throw new Error('options ' +
+ missing.slice(0, missing.length - 1).join(', ') + ' and ' +
+ missing[missing.length - 1] + ' must be defined');
+ }
+ else throw new Error('option ' + missing[0] + ' must be defined');
+ }
+ }
+ Object.keys(options).forEach(function(key) {
+ if (key in internalValues) {
+ internalValues[key] = options[key];
+ }
+ });
+ return this;
+ };
+ this.copy = function(keys) {
+ var obj = {};
+ Object.keys(defaults).forEach(function(key) {
+ if (keys.indexOf(key) !== -1) {
+ obj[key] = values[key];
+ }
+ });
+ return obj;
+ };
+ this.read = function(filename, cb) {
+ if (typeof cb == 'function') {
+ var self = this;
+ fs.readFile(filename, function(error, data) {
+ if (error) return cb(error);
+ var conf = JSON.parse(data);
+ self.merge(conf);
+ cb();
+ });
+ }
+ else {
+ var conf = JSON.parse(fs.readFileSync(filename));
+ this.merge(conf);
+ }
+ return this;
+ };
+ this.isDefined = function(key) {
+ return typeof values[key] != 'undefined';
+ };
+ this.isDefinedAndNonNull = function(key) {
+ return typeof values[key] != 'undefined' && values[key] !== null;
+ };
+ Object.freeze(values);
+ Object.freeze(this);
+}
+
+module.exports = Options;
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/package.json b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/package.json
new file mode 100644
index 0000000..8c9e173
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/package.json
@@ -0,0 +1,50 @@
+{
+ "author": {
+ "name": "Einar Otto Stangvik",
+ "email": "einaros@gmail.com",
+ "url": "http://2x.io"
+ },
+ "name": "options",
+ "description": "A very light-weight in-code option parsers for node.js.",
+ "version": "0.0.6",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/einaros/options.js.git"
+ },
+ "main": "lib/options",
+ "scripts": {
+ "test": "make test"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "mocha": "latest"
+ },
+ "gitHead": "ff53d0a092c897cb95964232a96fe17da65c11af",
+ "bugs": {
+ "url": "https://github.com/einaros/options.js/issues"
+ },
+ "homepage": "https://github.com/einaros/options.js",
+ "_id": "options@0.0.6",
+ "_shasum": "ec22d312806bb53e731773e7cdaefcf1c643128f",
+ "_from": "options@>=0.0.5",
+ "_npmVersion": "1.4.21",
+ "_npmUser": {
+ "name": "einaros",
+ "email": "einaros@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "einaros",
+ "email": "einaros@gmail.com"
+ }
+ ],
+ "dist": {
+ "shasum": "ec22d312806bb53e731773e7cdaefcf1c643128f",
+ "tarball": "http://registry.npmjs.org/options/-/options-0.0.6.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz"
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/.npmignore b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/.npmignore
new file mode 100644
index 0000000..6bfffbb
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/.npmignore
@@ -0,0 +1,5 @@
+npm-debug.log
+node_modules
+.*.swp
+.lock-*
+build/
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/README.md b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/README.md
new file mode 100644
index 0000000..55eb3c1
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/README.md
@@ -0,0 +1,3 @@
+# tinycolor #
+
+This is a no-fuzz, barebone, zero muppetry color module for node.js. \ No newline at end of file
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/example.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/example.js
new file mode 100644
index 0000000..f754046
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/example.js
@@ -0,0 +1,3 @@
+require('./tinycolor');
+console.log('this should be red and have an underline!'.grey.underline);
+console.log('this should have a blue background!'.bgBlue); \ No newline at end of file
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/package.json b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/package.json
new file mode 100644
index 0000000..50ec0ac
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/package.json
@@ -0,0 +1,43 @@
+{
+ "author": {
+ "name": "Einar Otto Stangvik",
+ "email": "einaros@gmail.com",
+ "url": "http://2x.io"
+ },
+ "name": "tinycolor",
+ "description": "a to-the-point color module for node",
+ "version": "0.0.1",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/einaros/tinycolor.git"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "main": "tinycolor",
+ "_npmUser": {
+ "name": "einaros",
+ "email": "einaros@gmail.com"
+ },
+ "_id": "tinycolor@0.0.1",
+ "_engineSupported": true,
+ "_npmVersion": "1.1.0-alpha-6",
+ "_nodeVersion": "v0.6.5",
+ "_defaultsLoaded": true,
+ "dist": {
+ "shasum": "320b5a52d83abb5978d81a3e887d4aefb15a6164",
+ "tarball": "http://registry.npmjs.org/tinycolor/-/tinycolor-0.0.1.tgz"
+ },
+ "maintainers": [
+ {
+ "name": "einaros",
+ "email": "einaros@gmail.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "320b5a52d83abb5978d81a3e887d4aefb15a6164",
+ "_from": "tinycolor@0.x",
+ "_resolved": "https://registry.npmjs.org/tinycolor/-/tinycolor-0.0.1.tgz"
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/tinycolor.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/tinycolor.js
new file mode 100644
index 0000000..36e552c
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/tinycolor.js
@@ -0,0 +1,31 @@
+var styles = {
+ 'bold': ['\033[1m', '\033[22m'],
+ 'italic': ['\033[3m', '\033[23m'],
+ 'underline': ['\033[4m', '\033[24m'],
+ 'inverse': ['\033[7m', '\033[27m'],
+ 'black': ['\033[30m', '\033[39m'],
+ 'red': ['\033[31m', '\033[39m'],
+ 'green': ['\033[32m', '\033[39m'],
+ 'yellow': ['\033[33m', '\033[39m'],
+ 'blue': ['\033[34m', '\033[39m'],
+ 'magenta': ['\033[35m', '\033[39m'],
+ 'cyan': ['\033[36m', '\033[39m'],
+ 'white': ['\033[37m', '\033[39m'],
+ 'default': ['\033[39m', '\033[39m'],
+ 'grey': ['\033[90m', '\033[39m'],
+ 'bgBlack': ['\033[40m', '\033[49m'],
+ 'bgRed': ['\033[41m', '\033[49m'],
+ 'bgGreen': ['\033[42m', '\033[49m'],
+ 'bgYellow': ['\033[43m', '\033[49m'],
+ 'bgBlue': ['\033[44m', '\033[49m'],
+ 'bgMagenta': ['\033[45m', '\033[49m'],
+ 'bgCyan': ['\033[46m', '\033[49m'],
+ 'bgWhite': ['\033[47m', '\033[49m'],
+ 'bgDefault': ['\033[49m', '\033[49m']
+}
+Object.keys(styles).forEach(function(style) {
+ Object.defineProperty(String.prototype, style, {
+ get: function() { return styles[style][0] + this + styles[style][1]; },
+ enumerable: false
+ });
+});